hamt
hamt copied to clipboard
Use interleaved key value arrays
First step of trying out #4, using interleaved key, value arrays like the clojure implementation does.
This is supposed to improve cache performance since no extra memory indirection is required to access leaf nodes.
The downsides are that it complicates the implementation and will require rethinking the internal structures a lot. There is also no guaranteed this will actually improve performance on a modern Javascript engine. In fact, when I tried this out as a simple experiment, it made the performance worse.
V1.0 gets the API into a better state to support this type of change.
Simple benchmark shows that striding has little benefit on its own: http://jsperf.com/strided-array-iteration
It could enable more optimizations though so perhaps still worth investigating.