hamstergem/hamster — pull request #88 by alexdowad (2014-05-25 16:06:51+00:00)
Title: Perf improvements

This patch changes 2 different O(n) operations to O(1).

For getting a set of keys from a Hamster::Hash, the key insight is that all the keys are already inside the Hash's Trie -- just stick that Trie inside a Hamster::Set, and you are done. Of course, this means that 2 equivalent Hamster::Set objects may have Tries with the same keys, but different values. The only operation which needs to be updated to deal with that situation correctly is Set#eql?.