On Oct 30, 2004, at 6:41 PM, Adam Warner wrote:
> I
> believe the code below demonstrates that, depending upon the
> idiosyncrasies of your hardware, an association list with 40 elements
> can
> be accessed faster than a hash table of those forty elements (both
> using
> an EQ test).
Using sbcl 0.8.15 on Mac OS X 10.3.5 on a dual G5 machine, the times
are almost exactly the same:
Assoc list count check 820000000
Evaluation took:
7.449 seconds of real time
6.46 seconds of user run time
0.95 seconds of system run time
0 page faults and
331,471,192 bytes consed.
Hash table count check 820000000
Evaluation took:
7.489 seconds of real time
6.52 seconds of user run time
0.89 seconds of system run time
0 page faults and
331,471,440 bytes consed.
So it would seem that, at least on this architecture, 40 elements is
the tipping point for sbcl. As Thomas Schilling pointed out, for other
lisps, the tipping point is significantly fewer elements. For example,
for LispWorks 4.3.7 the hash table times are still faster for as few as
5 elements.
regards,
Ralph
Raffael Cavallaro, Ph.D.
raffaelcavallaro@...