[REBOL] Re: Algorithm challenge: compacting integers
From: SunandaDH::aol::com at: 30-Jan-2007 14:11
Thanks to everyone who entered the first two challenges of this thread!
Comparing the code =E2=80=93 especially that of entries far better than mine - has
give me some insights into writing tighter, faster REBOL code. I hope everyone
who has joined in (even if you did not contribute any entries) has also
benefited in the same way.
Here are the results!
But first, the small print......
....Benchmarking the entries to find the "fastest" is neither *easy* nor
....Different solutions are optimised for different sized sets of integers,
and make different assumptions on how sparse the integer set will be. I reckon
every one would be a winner (or close runner up) under the right set of
....So what I've done is construct a set of data that closely resembles the
operating conditions for the indexes on the REBOL.org Mailing List Archive.
After all, that is the application for which I specifically need faster / better
code And the benchmarks below time the entrants on that set of data....
....The fastest in this benchmark is best suited for current Library data,
not the fastest under every circumstance.
....compact ......(fastest first)
....decompact ......(fastest first)
(The number after the name is the sequence in the thread where the code was
Congratulations to everyone who entered! And especially to Brian for the
fastest 'compact, and Viktor for the fastest 'decompact.
For anyone who wants to audit the results (especially to check if I have run
the right version of your code -- some people contributed several, and I may
have got a confused), the test driver and test entries are here:
Thanks again, and good luck with the next three challenges!