Plain JS vs Immutable vs mori (v6)

Revision 6 of this benchmark created on


Description

Fix errors due to Mixed Content

Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.7.5/immutable.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mori/0.3.2/mori.min.js"></script>

Setup

window.range = function(x) {
      var res = Array(x);
      for(var i = 0; i < x; i++) {
        res[i] = i;
      }
      return res;
    }
    window.plainList = range(1000);
    window.immutableList = Immutable.List(plainList);
    window.moriList = mori.vector.apply(null, plainList);
    window.optimizedList = range(1000);

Test runner

Ready to run.

Testing in
TestOps/sec
Plain JS
var l = plainList.concat();

for(var i = 0; i < 1000; i++) {
  l.push(i);
}
ready
Immutable
var l = immutableList;

l = l.withMutations(function(lst) {
  for(var i = 0; i < 1000; i++) {
    lst.push(i);
  }
});
ready
mori
var l = moriList;

l = mori.conj(l, range(1000));
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.