Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
childNodes vs children vs firstChild vs firstElementChild
Fastest way to list children
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
firstChild
17.0M/s
firstElementChild
16.4M/s
childNodes[0]
10.5M/s
children[0]
10.5M/s
View exact numbers
Test name
Executions per second
✓
firstChild
17,028,428 Ops/sec
firstElementChild
16,418,841 Ops/sec
childNodes[0]
10,484,387 Ops/sec
children[0]
10,450,944 Ops/sec
HTML Preparation code:
<html> <body> <div id='test'> <div name='a'></div> <div name='b'></div> <div name='c'></div> </div> </body> </html>
Script Preparation code:
var parent = document.getElementById('test');
Tests:
childNodes[0]
let n = parent.childNodes[0];
children[0]
let n = parent.children[0];
firstChild
let n = parent.firstChild;
firstElementChild
let n = parent.firstElementChild;