console.log performance
JavaScript performance comparison
Preparation code
<div id="container"></div>
<script>
Benchmark.prototype.setup = function() {
var container = document.getElementById("container");
function doSomethingAndWriteToLog() {
for(var i = 0 ; i < 100000 ; 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 < 100000 ; i++) {
var div = document.createElement("DIV");
var span = document.createElement("SPAN");
div.appendChild(span);
container.appendChild(div);
}
}
};
Benchmark.prototype.teardown = function() {
container.innerHTML = "";
};
</script>
Preparation code output
<div id="container"></div>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test | Ops/sec | |
---|---|---|
iterations with logging
|
|
pending… |
iterations without logging
|
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit
to the URL.
- Revision 1: published Praneet Loke
- Revision 2: published
- Revision 3: published
- Revision 4: published
- Revision 5: published
- Revision 6: published Nicolas Froidure
- Revision 7: published
- Revision 8: published Cody
- Revision 9: published Cody
- Revision 11: published
- Revision 12: published Marcin
- Revision 18: published
- Revision 19: published
0 Comments