peter-lawrey / HugeCollections-OLD

Huge Collections for Java using efficient off heap storage
273 stars 51 forks source link

Comparing behaviour of HugeHashMap with HashMap #21

Closed gilfernandes closed 10 years ago

gilfernandes commented 10 years ago

Hello,

I wrote a unit test which reads a dictionary file (https://raw.githubusercontent.com/eneko/data-repository/master/data/words.txt) first into net.openhft.collections.HugeHashMap and then java.util.HashMap, adding each word as the key and value, like so:

map.put(term, term);

After this the test dumps the result into a file.

The dump file of the hash map, looks like e.g:

:: Protorosaurus=Protorosaurus :: vocular=vocular :: Kunmiut=Kunmiut :: repaying=repaying :: aminolysis=aminolysis :: impavid=impavid :: preimpair=preimpair :: bradyphasia=bradyphasia :: indignation=indignation :: subshrubby=subshrubby ...

But the result of the hugeHashMap looks like:

:: elaidinic=divulgater :: circumlocution=elaidinic :: batitinan=circumlocution :: chevalier=batitinan :: conjunctivitis=chevalier :: Ettarre=conjunctivitis :: elative=Ettarre :: elliptically=elative :: cubicly=elliptically :: dermatomyoma=cubicly ...

Any ideas why this is so? Why does the dump generated by HugeHashMap not display in most cases a key equaling the value?

I do not expect the line order to be the same, but the content to have in most cases the key equal to the value.

The code for this test can be found here: https://gist.github.com/gilfernandes/145046a9f0b349c078b4

I am using Windows 7, Java 7 and the pom.xml of my test project contains this dependency:

        <dependency>
            <groupId>net.openhft</groupId>
            <artifactId>collections</artifactId>
            <version>3.0.2</version>
        </dependency>

Best regards,

Gil

RobAustin commented 10 years ago

Gil, thanks for finding this bug, we've created a fix for it in :

<dependency>
    <groupId>net.openhft</groupId>
    <artifactId>collections</artifactId>
    <version>3.0.3</version>
</dependency>
gilfernandes commented 10 years ago

Hello, Rob,

many thanks. My test seems to work now.

Regards