Immutable get & getIn path check

JavaScript performance comparison

Test case created by Sir.Nathan (Jonathan Stassen)

Preparation code

<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.1/immutable.min.js"></script>
      
<script>
Benchmark.prototype.setup = function() {
  var path = ['key'];
  var map = Immutable.Map({
    key: 'value'
  });

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
getIn()
return map.getIn(path);
pending…
get() with path length check
if (path.length === 1 && path[0].indexOf('.') === -1) {
  return map.get(path[0]);
}
pending…

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

0 Comments