Log

Edit: Philipp Marek kindly pointed out that where I claimed to
have 1M entries, I only had 100k. Oops! This has been corrected below,
other numbers altered correspondingly, and everything rerun. My point
still stands.

This is a bit of a rant, I guess. Sorry about that.

A few years back I needed a binary heap, and I needed one that was
fast and thread safe. So I wrote Pileup.

There are other heaps for Common Lisp, and some of them support
operations Pileup doesn't implement out of the box, and all of them
claim to be efficient.

...and I'm sure that algorithmically they are. However, constant
factors matter more often than you might think. I'll single out
CL-HEAP
primarily because it has such an authoritative name. :)

(I was also going to compare parallel performance, but CL-HEAP
doesn't appear to be thread-safe, so...)

This is not to disparage CL-HEAP: it supports things which
Pileup doesn't, but it clearly isn't written with constant factors in
mind, and this shows.

Constant factors matter.

(Admittedly, I tested this only on SBCL, and it might turn out that
CL-HEAP does a lot better — and Pileup a lot worse — on some other
implementation. This does not alter my main contention that you ignore
constant factors at your own peril.)

SBCL is an open source Common Lisp
compiler capable of generating code on par with C. Most of the time
it is within a small factor of C, but if you know what you're doing
then comparison to C is quite reasonable. I'm one of the current
developers and maintainers.