On 23 February 2010 20:36, Edward Z. Yang <[email protected]> wrote:
> This is an oversight in the test harness.  I went and made the test code
> hash the integers before inserting them.  Since the hashes are,
> internally, 32-bit or 64-bit integers, I don't really see any reason why
> IntMap couldn't be "genericized" for general use; you'd just have to
> make sure you has a hash function for your key data type!

That's a start. Then you'd also have to take care of key collisions.

Incidentally, there's no point in hashing word-sized integers.
(They're normally used as unchanged as their own hash values for
purposes of insertion into hash maps.)

>> By the way, I don't view this as a Haskell vs Clojure contest (GHC,
>> native code vs HotSpot, JVM), but rather one of data structures.
>
> That is my hope!  But unless I have totally misunderstood the algorithm
> in my Haskell reimplementation (which is quite possible, though I have
> reviewed it several times), the Haskell version is drastically slower
> than the Java implementation.  It could be the case that GC/Runtime/etc
> is critical to the performance of the algorithm.

I'm a bit confused now... Your initial numbers suggest there's not
much difference. Anyway, if your Haskell version doesn't perform very
well, perhaps it would be useful to ask some Haskell ninjas (from
Haskell Café maybe) have a look at it. I'm not one myself,
regrettably. :-)

> I was under the impression that Java hashCode() was also a machine
> sized integer.  Is this not the case?

What I had in mind was that hashCode() may be rather slow for more
complex objects... For your particular test it doesn't matter. There's
still the issue of collision resolution.

All best,
Michał

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to