smi vs double vs none

JavaScript performance comparison

Test case created by tkihira

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  const array1 = new Array();
  for (let i = 0; i < 1000000; i++) {
    array1[i] = (Math.random() * 100) | 0;
  }
  const array2 = new Array();
  array2[0] = 3.14;
  for (let i = 0; i < 1000000; i++) {
    array2[i] = (Math.random() * 100) | 0;
  }
  const array3 = new Array();
  array3[0] = "hello world";
  for (let i = 0; i < 1000000; i++) {
    array3[i] = (Math.random() * 100) | 0;
  }
  

};
</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
smi
let sum = 0;
for (let i = 0; i < array1.length; i++) {
    const value = array1[i];
    sum += value;
}
pending…
double
let sum = 0;
for (let i = 0; i < array2.length; i++) {
    const value = array2[i];
    sum += value;
}
pending…
(none)
let sum = 0;
for (let i = 0; i < array3.length; i++) {
    const value = array3[i];
    sum += value;
}
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