lazyVsConditional

Benchmark created on


Preparation HTML

<script>
  var nPasadas = 0;
  
  function normal_() {
    var nPos = 0;
    if (nPasadas === 0) {
      nPasadas++;
      return nPos++ * 10;
    } else {
      return nPos++ * 100
    }
  }
  
  function lazy_() {
    var nPos = 0;
    return nPos++ * 10;
    window.lazy = function() {
      return nPos++ * 100;
    };
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Normal
normal_();
ready
Lazy
lazy_();
ready

Revisions

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