Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Test id vs next sibbling
(version: 1)
Comparing performance of:
next sibbling vs based on id
Created:
one year ago
by:
Guest
Go to the latest result
HTML Preparation code:
<div class="js-tooltip" data-tooltip-id="tooltip-123"></div> <div id="tooltip-123" class="c-tooltip">test</div>
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
next sibbling
var tooltip = document.getElementsByClassName("js-tooltip")[0]; console.log(tooltip.nextElementSibling[0]);
based on id
var tooltip = document.getElementsByClassName("js-tooltip")[0]; console.log(document.getElementById(tooltip.dataset.tooltipId));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
next sibbling
based on id
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser/OS:
Chrome 134 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
next sibbling
659K/s
based on id
558K/s
View exact numbers
Test name
Executions per second
✓
next sibbling
658,525 Ops/sec
based on id
557,977 Ops/sec
Related benchmarks
id vs attribute
js mul vs pow
className vs classList normalization
Splti vs Trim vs replace className
testingqueries
test early return
Multiple .closest() or complex CSS selector
Query Element
Test content attribute vs html element
Comments
Confirm delete:
Do you really want to delete benchmark?