Pleased to announce the initial release of the "google_hash" gem. Its goal. To boldly be faster than any hash hash before (cue star trek TNG theme). The goal is basically a better hash, either one that is faster or more space efficient than ruby's default. To attempt this we wrap the google sparse and dense hashes [1]. Speed results (populating 500000 integers): 1.9.1p376 (mingw): Hash (Ruby default) 0.359375 (populate) 1.1875 (each) GoogleHashDense 0.1875 (populate) 0.078125 (each) GoogleHashSparse 0.53125 (populate) 0.078125 (each) Usage: a = GoogleHashDenseRubyToRuby.new # or GoogleHash.new b = GoogleHashDenseLongToRuby.new # :int => Ruby b = GoogleHashSparseLongToRuby.new # :int => Ruby a[3] = 4 b[4] = 'abc' b['abc'.hash] = 'some complex object' a.each{|k, v| ... } a.keys => Array a.values => Array To learn if sparse or dense is right for you, check their documentation: http://google-sparsehash.googlecode.com/svn/trunk/doc/index.html Installation: gem install google_hash (if on doze, you'll need the devkit installed) Both classes are currently more space efficient than a hash, because they store keys as "native" ints, so the keys no longer affect GC time, as well as only use 4 bytes instead of 20 (or 8 instead of 40, on 64 bit). This should release stress on the GC, and both GoogleHashDense and GoogleHashSparse do this. In terms of total memory usage GoogleHashDense uses more, and is more speedy, GoogleHashSparse uses less, and is much more memory efficient (2 bits per entry, or so I'm told). If you have a desired use case let me know and I might well be able to code it up for you. ex: currently it uses longs internally instead of ints--if you want ints or chars or what not, let me know. This is meant to be one more tool in the rubyists toolbelt when trying to optimize speed-wise, and plans to expand to more types, but at least with this release it has a #each method. Note that sparse maps can be saved to disk--ask if you want/need this functionality. Enjoy. -r [1] http://code.google.com/p/google-sparsehash If you want to see the code/hack on it, run extconf.rb within the ext directory, to create the code it actually uses (from a template).