insertBefore vs appendChild vs prepend vs insertAdjacentElementFastest: appendChild (1.2x faster)
2,035,246 ops/sec
2,026,518 ops/sec
1,851,382 ops/sec
1,759,052 ops/sec
Fastest: appendChild (1.4x faster)
22,768 ops/sec
19,942 ops/sec
19,108 ops/sec
15,744 ops/sec
Fastest: appendChild (1.1x faster)
4,118,536 ops/sec
4,038,958 ops/sec
3,974,502 ops/sec
3,740,958 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| insertBefore | |
| appendChild | |
| prepend | |
| insertAdjacentElement |
| Test name | Executions per second |
|---|---|
| ✓ appendChild | 1,170,184 Ops/sec |
| insertBefore | 736,837 Ops/sec |
| prepend | 312,196 Ops/sec |
| insertAdjacentElement | 210,410 Ops/sec |