Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
ChildNodes vs NextSibling
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0
Browser:
Firefox 151
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one month ago
Test name
Executions per second
ChildNodes
1458747.6 Ops/sec
NextSibling
4335346.0 Ops/sec
Script Preparation code:
var t = document.createElement('template'); t.innerHTML = '<tr><td class="col-md-1"></td><td class="col-md-4"><a></a></td><td class="col-md-1"><a><span class="glyphicon glyphicon-remove" aria-hidden="true" /></a></td><td class="col-md-6" /></tr>'; var template = t.content.firstChild; function childNodes(tree) { let index = 0; const result = {}; const walk = (node) => { result[index++] = node; node.childNodes.forEach(walk); }; walk(tree); return result; } function nextSibling(tree) { let index = 0; const result = {}; const walk = (node) => { result[index++] = node; let child = node.firstChild; while(child) { walk(child); child = child.nextSibling; } }; walk(tree); return result; }
Tests:
ChildNodes
childNodes(template)
NextSibling
nextSibling(template)