uklance

London, United Kingdom

18h
comment Which collection should I use to check if a value is in the collection of 100K elements?
Yes, under your circumstances the in memory solution is 50 minutes faster and that's nothing to be sneezed at if that is the case. I think that optimisations like this should only be done later, when you are seeing that the process is slow. Until that time, I would choose the more scalable approach which avoides a big chunk of memory.
19h
comment Which collection should I use to check if a value is in the collection of 100K elements?
You should not really think about it like that. The worst case scenario is that for n records, you will do n inserts to the database [complexity = O(n)]. Even if you manage to avoid half of the inserts (n/2) by checking a collection in the JVM, it is still a complexity of O(n) since O(n/2) = O(n). en.wikipedia.org/wiki/Time_complexity. Therefore, I would choose the solution which avoids storing the collection in memory since both solutions have a complexity of O(n).
20h
comment Which collection should I use to check if a value is in the collection of 100K elements?
Actually, thinking about this again you're right. There's extra network traffic involved. But the bonus is you don't need to keep 100,000 records in memory in the JVM
20h
comment Which collection should I use to check if a value is in the collection of 100K elements?
As long as the column is indexed, it's the same. It's just a java index lookup vs a database index lookup. Both should be constant time O(1)
20h
awarded Yearling
20h
answered Which collection should I use to check if a value is in the collection of 100K elements?
23h
revised Tapestry: custom component and title in Grid header
deleted 48 characters in body
23h
revised Tapestry: custom component and title in Grid header
deleted 49 characters in body
23h
answered Tapestry: custom component and title in Grid header
1d
answered how to exclude java sources from a third party jar?
May
20
awarded Revival
May
16
revised Eclipse gradle and maven tooling - local resolution
edited title
May
16
revised Eclipse gradle and maven tooling - local resolution
added 122 characters in body
May
16
answered Eclipse gradle and maven tooling - local resolution
May
16
revised Eclipse gradle and maven tooling - local resolution
deleted 95 characters in body
May
15
comment Object is not an indexed entity or a subclass of an indexed entity
If you want to @Inject FullTextSession instead of what you are doing here, add the following to your AppModule gist.github.com/uklance/5582542
May
13
asked Eclipse gradle and maven tooling - local resolution
May
5
awarded Peer Pressure
May
3
answered Executing SQL Server stored procedure in sql squirrel
Apr
27
revised How to change class="active" on selected item from Layout - Tapestry
added 310 characters in body
1 2 3 4 5