comparing with multi

JavaScript performance comparison

Test case created by Carlos Vázquez

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  ABArray = ['A', 'B'];
  ABObject = {A: 0, B: 0};
  A = 'A';
  B = 'B';
  belong = 'A';
  notBelong = 'C';

};
</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
Pure, belongs
belong === A || belong === B
pending…
IndexOf array, belongs
ABArray.indexOf(belong) > -1
pending…
In object, belongs
belong in ABObject
pending…
in object, doesn't belong
notBelong in ABObject
pending…
Pure, doesn't belong
notBelong === A || notBelong === B
pending…
IndexOf, doesn't belong
ABArray.indexOf(notBelong) > -1
pending…

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

0 Comments