isqeualnode-vs-id

JavaScript performance comparison

Test case created

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="foo"></div>
<div id="bar"></div>
<div id="compare"></div>
<script>
Benchmark.prototype.setup = function() {
    var compare = document.getElementById('compare');
    var foo = document.getElementById('foo');
    var bar = document.getElementById('bar');
    var elements = [foo, bar, compare];
   
   
};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
isEqual left side
var i = elements.length;
while(i--)
{
  elements[i].isEqualNode(compare);
}
pending…
isEqual right side
var i = elements.length;
while(i--)
{
  compare.isEqualNode(elements[i]);
}
pending…
compare with id side 1
var i = elements.length;
while(i--)
{
  compare.id === elements[i].id;
}
pending…
compare with id side 2
var i = elements.length;
while(i--)
{
   elements[i].id === compare.id;
}
pending…
for
var i=0, length = elements.length;
for(var i=0; i<length; i++)
{
   elements[i].id === compare.id;
}
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment