multiplication vs test

JavaScript performance comparison

Test case created by SuperSkunk

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var test1 = 1;
    var test2 = 2;
    var test3 = 0;
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
multiplication
if (test1 * test2 * test3 === 0) {
  test1 = test2 + test3;
}
pending…
test
if (test1 === 0 || test2 === 0 || test3 === 0) {
  test1 = test2 + test3;
}
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

Add a comment