admnifqhrianfkjasnlkns

JavaScript performance comparison

Test case created by porrungroj

Preparation code

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"/>
      
<script>
Benchmark.prototype.setup = function() {
  const length = 10000;
  const array = [...Array(length).keys()];
  //const array = _.shuffle([...Array(length).keys()]);
  const set = new Set(array);
  

};
</script>

Preparation code output

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"/>

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
s
for (let i = 0; i < length; i++) set.has(i);
pending…
a
for (let i = 0; i < length; i++) array.includes(i);
pending…

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

Compare results of other browsers

0 Comments