Nab (v10)

Revision 10 of this benchmark created on


Description

Demonstrating the performance hit caused by nested functions.

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
  function a() {
    for (var i = 0; i < 10; i++) {
      $("body").append("<div>a" + i + "</div>");
    }
  }

  function b() {
    var j = "";
    for (var i = 0; i < 10; i++) {
      j += "<div>a" + i + "</div>";
    }
    $("#d1").append(j);
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Optimized (No Nesting)
a();
ready
Nested Function
b();
ready

Revisions

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