console.log performance (v7)

Revision 7 of this benchmark created on


Preparation HTML

<div id="container"></div>

Setup

var container = document.getElementById("container");
  
  function doSomethingAndWriteToLog() {
    for(var i = 0 ; i < 1000 ; i++) {
      var div = document.createElement("DIV");
      var span = document.createElement("SPAN");
      div.appendChild(span);
      container.appendChild(div);
      console.log(i);
    }
  }
  
  function justDoSomething() {
    for(var i = 0 ; i < 1000 ; i++) {
      var div = document.createElement("DIV");
      var span = document.createElement("SPAN");
      div.appendChild(span);
      container.appendChild(div);
    }
  }
  
  console.log = function(){};

Teardown



            container.innerHTML = "";
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
iterations without logging
justDoSomething();
ready
iterations with logging
doSomethingAndWriteToLog();
ready

Revisions

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