|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
Re: HashSet performanceOne thing to consider is that if
(a) you have high-quality hashCode() functions, and (b) you have fewer than 2^15 elements, then you could trivially carve two independent functions out of one hash code. Likewise, three if you have fewer than 2^10, etc. Problem is, (a) is almost never the case, is it? :) On Tue, Jun 10, 2008 at 11:22 AM, Martin Buchholz <martinrb@...> wrote:
-- Kevin Bourrillion @ Google internal: go/javalibraries google-collections.googlecode.com google-guice.googlecode.com _______________________________________________ Concurrency-interest mailing list Concurrency-interest@... http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest |
|
|
Re: HashSet performanceOn Tue, Jun 10, 2008 at 2:38 PM, Martin Buchholz <martinrb@...> wrote:
Yep, I verified this fact a few weeks ago. And I agree that it's evil; it causes some extremely bizarre situations. -- Kevin Bourrillion @ Google internal: go/javalibraries google-collections.googlecode.com google-guice.googlecode.com _______________________________________________ Concurrency-interest mailing list Concurrency-interest@... http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest |
|
|
Re: HashSet performanceHi Osvaldo,
On Tue, Jun 10, 2008 at 9:31 PM, Osvaldo Pinali Doederlein <osvaldo@...> wrote:
This sound like very good idea to me.
It is implemented in the native layer, but it is not necessarily faster than HashMap or ConcurrentHashMap. Actually it used to be much slower in JDK 1.4.2 because the JVM used a relatively small hashtable and if you interned enough Strings it would degenerate because it uses linked lists to resolve collisions. "We" fixed this in the SAP JVM and I think newer Java version got better as well. Still, ConcurrentHashMap can be faster in case you have parallel access by many threads. The main advantage of String.intern() is that it acts like a WeakHashmap, but without the high memory overhead. In the SAP JVM we therefore implemented an optimized String.intern(), which is fast enough for us for now, but it would be really nice to have an optimized ConcurrentWeakSet with support for the API you described above. Regards, Markus
_______________________________________________ Concurrency-interest mailing list Concurrency-interest@... http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest |
| < Prev | 1 - 2 | Next > |
| Free Forum Powered by Nabble | Forum Help |