[plt-scheme] (Speed) difference between make-hash and make-hasheq

From: JW (jw00000 at gmail.com)
Date: Sat Aug 23 08:30:35 EDT 2008

Hi everyone,

I'm just starting out with (PLT) Scheme, and I have a simple question
for you. I was solving some problems at Project Euler, to get to know
PLT Scheme. The last one, problem 14
(http://projecteuler.net/index.php?section=problems&id=14) was a
particularly tough one for me, since I couldn't get my solution to
work fast enough. Eventually, I solved the problem, by making my
program run for about 5 minutes straight. Afterwards, I looked at
solutions other people had written, and I found one that finished in
less than 20 seconds. I searched for what could be wrong with my
solution, and I found out that the hash table I used to cache results,
made the whole thing several times slower.

Eventually, I found out that using (make-hash) instead of
(make-hasheq) was the root of all my problems. Why is that? Is it
normal that there's such a speed difference between using 'equal?' and
For the record, I am using 'MzScheme v4.0 [cgc]', installed through
the Ubuntu repositories (where it's marked version 2:4.0-1ubuntu1).
I also put the code at http://pastie.org/258542: running it using
(make-hasheq) takes about 5 seconds, with (make-hash) it takes > 5

Any help is appreciated,

Posted on the users mailing list.