createTextNode vs textContent vs innerText vs append vs new textFastest: textContent (3.9x faster)
11,641,434 ops/sec
5,097,660 ops/sec
4,276,313 ops/sec
3,627,731 ops/sec
3,004,156 ops/sec
Fastest: textContent (1.7x faster)
3,873,182 ops/sec
3,712,256 ops/sec
2,732,788 ops/sec
2,323,662 ops/sec
2,230,742 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| createTextNode | |
| textContent | |
| innerText | |
| append | |
| new text |
| Test name | Executions per second |
|---|---|
| ✓ append | 4,046,192 Ops/sec |
| textContent | 3,381,388 Ops/sec |
| new text | 2,954,413 Ops/sec |
| createTextNode | 2,371,034 Ops/sec |
| innerText | 2,230,742 Ops/sec |