I just came across this blog post which benchmarks several hash implementations in C and C++ including the hashes or Python and Ruby.
I was wondering if someone wanted to fork the benchmarks on GitHub and add a Perl entry. I haven't done C in a while and I've never done XS, so I'm probably not the best person for that job.
Any volunteers?
http://incise.org/hash-table-benchmarks.html#comment-41586779
Re:I gave it a super-quick shot...
tsee on 2010-03-25T22:08:02
Oh, hasn't appeared yet (moderation?). Below is the text of my comment. In a nutshell, for the cases benchmarked, perl is somewhat faster than python (and a lot faster than Ruby) and uses about as much memory as Ruby, which is somewhat less than Python.
I did a quick-and-dirty implementation for Perl-hashes. Take the results with a grain of salt. I made a coding mistake with the deletion benchmark, so I didn't include it. I also skipped the integer benchmarks because Perl doesn't have an integer hashmap. You can insert integers, but they'll be converted to strings anyway, so you get the same performance as with strings. Results: http://steffen-mueller.net/hashbench/charts.html Code: http://steffen-mueller.net/hashbench/perl_hash.c Makefile: http://steffen-mueller.net/hashbench/Makefile