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>
var a = document.getElementById('divinputme'),
b = document.getElementById('spaninputme'),
c = document.getElementById('labelinputme');
var s = '1,2,3,4';
a.innerHTML = s;
b.innerHTML = s;
c.innerHTML = s;
var an = a.firstChild,
bn = b.firstChild,
cn = c.firstChild;
var ah = a.offsetHeight,
bh = b.offsetHeight,
ch = c.offsetHeight;
var set_text = function (ep, t) {
ep.textContent = t;
}
var set_text_2 = function (ep, t) {
ep.innerText = t;
}
var set_text_3 = function (ep, t) {
ep.innerHTML = t;
}
var textContentIsBetter = true;
var innerTextIsBetter = true;
var innerHTMLIsBetter = true;
Ready to run.
Test | Ops/sec | |
---|---|---|
innerText - div |
| ready |
innerText - span |
| ready |
innerText - label |
| ready |
innerHTML - div |
| ready |
innerHTML - span |
| ready |
innerHTML - label |
| ready |
textContent - div |
| ready |
textContent - span |
| ready |
textContent - label |
| ready |
nodeValue - div |
| ready |
nodeValue - span |
| ready |
textContent via function |
| ready |
innerText 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.