hamt icon indicating copy to clipboard operation
hamt copied to clipboard

Use interleaved key value arrays

Open mattbierner opened this issue 9 years ago • 1 comments

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.

mattbierner avatar Jan 03 '16 09:01 mattbierner

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.

mattbierner avatar Jan 03 '16 19:01 mattbierner