Re: java.util.HashMap issues -- SimpleORM Benchmarking

Anthony Berglas <[email protected]>
Newsgroups gmane.comp.java.orm.simpleorm
Message-ID <[email protected]>
After much stuffing around the bug turned out to be under my nose.

SDataSet.contains used to call map.containsValue instead of 
map.containsKey.  So was doing an n^2 linear search.

Certainly the hash function is poor, with 3991 .equals calls for just 
2001 contains(), but that is not enough to kill the whole performance.

Anthony

At 05:58 PM 8/08/2008, Anthony Berglas wrote:

>I have been tidying up the benchmarks, and I have installed and
>tested against Oracle 11g.
>
>The Netbeans profiling suggests that our main performance issue is
>the HashMap in SDataSet. We are getting *Many* collisions, with our
>Equals method sometimes being called dozens of times per hash lookup
>(SDataSet.contains).
>
>I checked the hash code, and the values returned look fine -- no
>duplicates. I tried making the hash map huge, still lots of collisions.
>
>Then I looked at the strange hash code in Java, which is well described in
><http://hioctane.blogspot.com/2005/09/some-insight-into-hashmap-and-hashcode.html>http://hioctane.blogspot.com/2005/09/some-insight-into-hashmap-and-hashcode.html
>
>And sure enough, after passing our hash code through their secondary
>hasher we get lots of collisions.
>
>So a better hash map would be good. Does anyone have one or want to build one?
>
>Set SDataSet.TRACE_HASH to true to see the traces.
>
>For our (relatively) slow querySequential test the hash takes 140 ms
>out of 203 ms.
>(This is actually the fastest test, at 203 micro seconds/record,
>which makes the hash problem visible.)
>
>Anthony
>
>Dr Anthony Berglas, 
><mailto:anthony%40berglas.org>[email protected] Mobile: +61 4 4838 8874
>Just because it is possible to push twigs along the ground with ones nose
>does not necessarily mean that is the best way to collect firewood.
>
>

Dr Anthony Berglas, [email protected]       Mobile: +61 4 4838 8874
Just because it is possible to push twigs along the ground with ones nose
does not necessarily mean that is the best way to collect firewood.

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/SimpleORM/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
a0a965a.jpg (image/jpeg, 3.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.