testing stuff (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<ul>  
    <li value="10">Item One</li>
    <li value="20">Item Two</li>
    <li value="30">Item three</li>
    <li value="40">Item Four</li>
    <li value="50">Item Five</li>
</ul>

Test runner

Ready to run.

Testing in
TestOps/sec
each
var myVals = [];
$('li','ul').each(function(){
  myVals.push($(this).attr('value'));
});
 
ready
map
var myVals = [];
$('li','ul').map(function(){
  myVals.push($(this).attr('value'));
});
 
ready
No jquery
var elements = (document.getElementsByTagName('li'));
var vals = [];
for(var i=0;typeof(elements[i])!='undefined';vals.push(elements[i++].getAttribute('value')));
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.