3 ms·
TS works well. But ImmutableJS is slow, really slow. https://jsperf.com/immutable-js-iteration https://jsperf.com/immutable-js-iteration
by hatch_q 7y ago
TS works well. But ImmutableJS is slow, really slow.
https://jsperf.com/immutable-js-iteration https://jsperf.com/immutable-js-iteration
- jkoudys 7y agoI wouldn't go by benchmarks run against a 100-length array of numbers. That's so small it's practically a tuple. Where immutable.js improves your perf is if you need to have very large (1M+) datasets, and/or need to keep references to those data over time for thing like undo, diffing, saving those diffs, etc. If you used a pure array that's 1M, that'd be over 64MB per array, so at just 10 levels of undo you could already exhaust your heap. Immutable.js would be barely over 64MB for hundreds of levels of undo, since it can rely on the last state being immutable it can store only the diffs. Immutable.js was a bad solution when it was used purely to enforce immutability. Unfortunately that's what its reputation became, but really it should be thought of as a lib that takes advantage of immutable data, not a lib that checks for immutability.