Remove firstChild vs Remove lastChild vs innerHTML vs innerText vs textContent vs firstChild.remove vs rangeFastest: firstChild.remove (7.5x faster)
16,097,530 ops/sec
15,965,818 ops/sec
15,821,484 ops/sec
7,571,229 ops/sec
7,328,925 ops/sec
6,850,505 ops/sec
2,141,762 ops/sec
Fastest: firstChild.remove (3.6x faster)
5,366,172 ops/sec
5,280,378 ops/sec
5,269,151 ops/sec
4,249,256 ops/sec
3,838,541 ops/sec
3,787,302 ops/sec
1,488,472 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Remove firstChild | |
| Remove lastChild | |
| innerHTML | |
| innerText | |
| textContent | |
| firstChild.remove | |
| range |
| Test name | Executions per second |
|---|---|
| ✓ firstChild.remove | 45,451,428 Ops/sec |
| Remove lastChild | 45,172,348 Ops/sec |
| Remove firstChild | 45,105,476 Ops/sec |
| innerText | 17,209,156 Ops/sec |
| textContent | 9,193,548 Ops/sec |
| innerHTML | 8,677,073 Ops/sec |
| range | 4,956,853 Ops/sec |