Fast/Slow If First

JavaScript performance comparison

Test case created by Vaughn

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var test = 344;
    var test2 = "testing";
    var test3 = 1;
    var test4 = 2930231;
};
</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
Flat Fast If First
if (test == 344 && test2 == "testing" && test3 == 2 && test4 * 3223 / 33 + 2 == 2) {
  //
}
pending…
Flat Slow If First
if (test == 344 && test2 == "testing" && test4 * 3223 / 33 + 2 == 2 && test3 == 2) {
  //
}
pending…
Nested Fast If First
if (test == 344) {
  if (test2 == "testing") {
    if (test3 == 2) {
      if (test4 * 3223 / 33 + 2 == 2) {
        //
      }
    }
  }
}
pending…
Nested Slow If First
if (test == 344) {
  if (test2 == "testing") {
    if (test4 * 3223 / 33 + 2 == 2) {
      if (test3 == 2) {
        //
      }
    }
  }
}
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