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
Finding the fastest way to update the textual (non-HTML) contents of an HTML element.
var el = document.createElement('span');
document.body.appendChild(el);
var strings = [
"Test string 1.",
"Test string 2.",
"Third string test",
"A fourth for <em>testing</em>",
"Maybe one with a <div>div</div>",
"Just good 'ol plaintext here, folks.",
"And one with a line break.",
"Some more text"
],
str,
len = strings.length,
c = -1,
n;
el.parentNode.removeChild(el);
Ready to run.
Test | Ops/sec | |
---|---|---|
Basic textContent |
| ready |
TextNode |
| ready |
TextNode textContent |
| ready |
TextNode textContent +unHTML Support |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.