Open mitchellwrosen opened 3 years ago
I'm working hard to expand that gap. I just found a shape invariant bug in pqueue
whose fix should make it faster for such applications. And I've started the work of making the pqueue
representation more compact, which should improve matters further (especially for larger queues).
Taking a brief glance at the code, I suspect it might help to have a special representation of trees of rank 0. Currently, those take four words. That can easily be reduced to two. The Forest
type can then be modified to be nonempty (either by adjoining an element in front or by turning its nil into a constructor that holds a tree; I'm not sure which is better, but my guess is the latter).
Hi, I just thought I'd share this small benchmark I wrote while investigating the speed of various priority queue libraries. Perhaps there's something wrong with the methodology, but if not,
heaps
appears to be ~1.4-1.5x slower thanpqueue
/psqueue
at inserting 100 random elements (each with one of 10 distinct priorities), then popping them all.Link to another issue that contains the benchmark: https://github.com/HeinrichApfelmus/reactive-banana/issues/214