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
We shouldn't care about string concatenation, or outerHTML returns; we want to know if using innerHTML or createElement is faster. We also don't care about adding to a "live" element, but one that is hidden; just in a variable for example.
For that reason, I have created the innerHTML string and the target "container" div before the test.
var container = document.createElement("DIV");
var HTML = new Array(101).join("<span></span>");
Ready to run.
Test | Ops/sec | |
---|---|---|
100 element innerHTML |
| ready |
createElement and appendChild |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.