Fork me on GitHub
#cljs-dev
<
2018-10-10
>
favila16:10:33

I noticed that hash-ordered-coll and hash-unordered-coll docstrings talk about hashing any iterable (copied from CLJ I think) but the CLJS implementation actually uses seq

favila17:10:00

is there any interest in making cljs actualy use -iterator? Seems like it would be much more efficient

dnolen18:10:41

benchmarks would be good here

favila22:10:54

quick comparison shows some benefit

favila22:10:24

BEFORE (seqs)
[coll hash-coll-test], (or (== (hash-ordered-coll coll) -1266761014) (throw (js/Error. "bad"))), 1000 runs, 2385 msecs
[coll hash-imap-test], (or (== (hash-unordered-coll coll) -897742717) (throw (js/Error. "bad"))), 1000 runs, 7538 msecs
[coll hash-imap-int-test], (or (== (hash-unordered-coll coll) 1787591846) (throw (js/Error. "bad"))), 1000 runs, 8392 msecs


AFTER (iterators)
[coll hash-coll-test], (or (== (hash-ordered-coll coll) -1266761014) (throw (js/Error. "bad"))), 1000 runs, 1877 msecs
[coll hash-imap-test], (or (== (hash-unordered-coll coll) -897742717) (throw (js/Error. "bad"))), 1000 runs, 5829 msecs
[coll hash-imap-int-test], (or (== (hash-unordered-coll coll) 1787591846) (throw (js/Error. "bad"))), 1000 runs, 6828 msecs

favila22:10:46

using d8 on an i7

favila22:10:52

these are 10000-item collections; on 1000-item collections at 100 iterations (what benchmark-runner uses) there's no difference, at least on my machine