Don't be afraid of the Hashmap

Everyone knows about ruby’s hashmaps, hashmaps are almost a given for a high level programming language. Hashmaps do seem to be a rather strange concept because it is not a trivial data structure to implement. This leaves most programmers uninformed to the question of weather hashmaps scale. You may ask yourself, is it a good idea to hold a large amount of objects in a hashmap that is temporary so that it should not be wasted on a database?

The answer is yes.

Ruby uses a particularly powerful and fast hashing algorithm called the Murmur algorithm. That is not the interesting part, the interesting part is that ruby hashmaps rehash based off of density so that they are highly efficient and accessing an element from a hashmap with a million elements is about as fast as accessing an element in a map of five.

Hashmaps do scale and are very efficient, so do not worry about their speed except in special cases where ruby probably has no place anyway. I just thought it was interesting.