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
what method for empty a element is faster ?
<div id='box'></div>
var box = document.getElementById('box');
var innerBox1 = document.createElement('DIV');
var innerBox2 = document.createElement('DIV');
var innerBox3 = document.createElement('DIV');
var innerBox4 = document.createElement('DIV');
var innerBox5 = document.createElement('DIV');
var innerBox6 = document.createElement('DIV');
box.appendChild(innerBox1);
box.appendChild(innerBox2);
innerBox1.appendChild(innerBox3);
innerBox1.appendChild(innerBox4);
innerBox2.appendChild(innerBox5);
innerBox2.appendChild(innerBox6);
var innerBox1 = document.createElement('DIV');
var innerBox2 = document.createElement('DIV');
var innerBox3 = document.createElement('DIV');
var innerBox4 = document.createElement('DIV');
var innerBox5 = document.createElement('DIV');
var innerBox6 = document.createElement('DIV');
box.appendChild(innerBox1);
box.appendChild(innerBox2);
innerBox1.appendChild(innerBox3);
innerBox1.appendChild(innerBox4);
innerBox2.appendChild(innerBox5);
innerBox2.appendChild(innerBox6);
Ready to run.
Test | Ops/sec | |
---|---|---|
removeFirstChild |
| ready |
innerHTML |
| ready |
removeLastChild |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.