3 ms·
I've run across a couple HAMT implementations you might not have seen: https://github.com/mattbierner/hamt/ https://github.com/mattbierner/hamt/ https://github
by grayrest 12y ago
I've run across a couple HAMT implementations you might not have seen:
https://github.com/mattbierner/hamt/ https://github.com/mattbierner/hamt/
https://github.com/Tvaroh/moreartyjs https://github.com/Tvaroh/moreartyjs
The first implementation (hamt) is interesting because it's in a same semantics compile-to-js language (by the author) called Khepri and it benchmarks pretty well on datastructure microbenchmarks.
http://khepri-lang.com/ http://khepri-lang.com/
https://github.com/mattbierner/js-hashtrie-benchmark https://github.com/mattbierner/js-hashtrie-benchmark
The second is a less interesting pure JS implementation that I show as faster than mori and slower than hamt on the hashtrie-benchmark. I've been meaning to test them on a wider variety of benchmarks (more aggregate operations and vs transients) but I only ran across them last week and I've been busy.
- swannodette 12y agoThanks for the links. Sadly doing mori benchmarks like this does't say as much about the performance of ClojureScript data structures than it does about mori specifically - in many cases you are likely just benchmarking multi-arity function dispatch overhead because you don't have the ClojureScript compiler doing direct dispatch for you. If you want accurate benchmarking of ClojureScript data structures you will need to write the benchmark in ClojureScript for the time being and call them from JavaScript. Also benchmarking in Node.js doesn't reflect the wide variance you find in JS engines. In several cases in the past we avoided V8 specific optimizations because it punished other JS engines. UPDATE: I also ran some benchmarks and I can't replicate the perf degradation as the size of the hash map increases. My suspicion is that the random key generation may result in many hash collisions w/ Murmur3 which would explain the dramatic perf degradation which is unlikely to occur in the wild.
- grayrest 12y agoI appreciate the response. I was wondering about the lower Mori numbers here because I was sure I'd seen much higher numbers in cljs benchmarks.
- mattbierner 12y agoWith the js-hashtrie-benchmark, I wanted to get a rough idea of the relative performance characteristics of the various libraries. Compiling the Mori benchmarks in ClojureScript may produce technically more accurate results, while also giving Mori a sizable compiler optimization advantage over the other libraries, but I was mainly interested in how the various implementations performed when called from JS. I'm not a benchmarking or ClojureScript expert, so please let me know if you find any problems with my benchmarks or can make any improvements to make them more accurate. Hashing is one area that I need to investigate more in my libraries and in the benchmarks. Getting more than one datapoint would be nice too. None of my code is optimized specifically for Node, so seeing benchmarks on other engines would be interesting.
- mattbierner 12y agoAuthor of the HAMT library and Khepri here. Hadn't heard of moreartyjs before, but it looks like a neat project. I would be interested in seeing your benchmarks too. Please let me know if you find any problems or have any suggestions for HAMT or js-hashtrie-benchmarks.