ie ternary test

Benchmark created by KooiInc on


Preparation HTML

<script>
  function loop(useTernary) {
   var n = 1000,
       dummy = 1;
   if (useTernary) {
    while (--n) {
     dummy = n > 500 ? 1 : 2;
    }
   } else {
    while (--n) {
     if (n > 500) {
      dummy = 1;
     } else {
      dummy = 2;
     }
    }
   }
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
/w ternary
loop(true);
ready
no ternary
loop();
ready

Revisions

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