Descriptionruntime: Improve the map implementation.
New version is somewhat faster and use somewhat less memory.
Mapping is done in two stages:
1) mapping from the hash value to a dense
range of cell IDs.
2) mapping from dense range of cell IDs to
key/value pairs.
Keeping the key/value pairs in a separate,
growable-array structure makes the iteration
semantics easy. The implementation of #1 can
then ignore iteration and just go for fast/dense
encoding.
Experiments put lookup at ~20% faster and insert
at about 50% faster. Also uses slightly less
memory.
First bug-free version.
Patch Set 1 #Patch Set 2 : diff -r 0bf8fba16ea2 https://code.google.com/p/go/ #Patch Set 3 : diff -r 988d73fb1a18 https://code.google.com/p/go/ #
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||