childNodes vs children vs firstChild nextSibling vs firstElementChild nextElementChild vs ChildNodes2Fastest: firstElementChild nextElementChild (10.2x faster)
9,202,290 ops/sec
6,537,164 ops/sec
2,551,081 ops/sec
1,349,660 ops/sec
905,020 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| childNodes | |
| children | |
| firstChild nextSibling | |
| firstElementChild nextElementChild | |
| ChildNodes2 |
| Test name | Executions per second |
|---|---|
| ✓ firstElementChild nextElementChild | 11,051,960 Ops/sec |
| firstChild nextSibling | 7,975,128 Ops/sec |
| ChildNodes2 | 3,174,581 Ops/sec |
| children | 1,717,998 Ops/sec |
| childNodes | 1,170,831 Ops/sec |