Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
While loop vs Closest fork1
(version: 0)
Comparing performance of:
while vs closest
Created:
2 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <style type="text/css"> .hidden { display: none; } </style> <div class="visible"> <div class="hidden"> <div class="hidden"> <div class="hidden hidden-last"></div> </div> </div> </div> <script> Benchmark.prototype.setup = function() { var $element = $('.hidden-last'); }; </script>
Tests:
while
while ($element[0].classList.contains('hidden')) { $element = $element.parent(); }
closest
$element = $element[0].closest(':not(.hidden)')
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
while
closest
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?