testing stuff (v17)

Revision 17 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/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').each(function() {
  myVals.push($(this).attr('value'));
});
ready
map
var myVals = [];
$('li').map(function() {
  myVals.push($(this).attr('value'));
});
ready
by tag
var elements = (document.getElementsByTagName('li'));
var vals = [];
for (var i = 0; typeof(elements[i]) != 'undefined'; vals.push(elements[i++].getAttribute('value')));
ready
by jquery
var elements = $('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.