JS Branch Prediction

JavaScript performance comparison

Test case created by rv-alwilliams

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
Unsorted
let arr = Array.apply(null, {length: 10000}).map(() => Math.floor(Math.random() * 256));
let sum = arr.reduce((a, b) => {
  if (b <= 128) {
    return a + b;
  }
  return a;
}, 0);
arr = arr.sort();
pending…
Sorted
let arr = Array.apply(null, {length: 10000}).map(() => Math.floor(Math.random() * 256));
arr = arr.sort();
let sum = arr.reduce((a, b) => {
  if (b <= 128) {
    return a + b;
  }
  return a;
}, 0);
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