jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
<div id="divinputme" style="position:absolute;left:10px;top:0">x</div>
<span id="spaninputme" style="position:absolute;left:110px;top:0">x</span>
<label id="labelinputme" style="position:absolute;left:210px;top:0">x</label>
'use strict';
var a = document.getElementById('divinputme'),
b = document.getElementById('spaninputme');
var s = '1,2,3,4';
a.innerHTML = s;
b.innerHTML = s;
var an = a.firstChild,
bn = b.firstChild;
var ah = a.offsetHeight,
bh = b.offsetHeight;
var set_text = function (ep, t) {
ep.textContent = t;
}
var set_text_2 = function (ep, t) {
var n = ep.firstChild;
if (n) {
n.nodeValue = t;
}
else {
n.appendChild(document.createTextNode(t));
}
}
var set_text_3 = function (ep, t) {
ep.innerHTML = t;
}
var textContentIsBetter = true;
var nodeValueIsBetter = true;
var innerHTMLIsBetter = true;
Ready to run.
Test | Ops/sec | |
---|---|---|
innerText - div |
| ready |
innerText - span |
| ready |
innerHTML - div |
| ready |
innerHTML - span |
| ready |
textContent - div |
| ready |
textContent - span |
| ready |
nodeValue - div |
| ready |
nodeValue - span |
| ready |
textContent via function |
| ready |
nodeValue via function |
| ready |
innerHTML via function |
| ready |
if (for Chrome) |
| ready |
if (for FF) |
| ready |
if (for IE) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.