jQuery Cached Set

JavaScript performance comparison

Revision 32 of this test case created by

Preparation code

<style>
.clase{
color: "#ff0000";
text-decoration: "underline";
background-color: "#eeeeee";
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="top" class="mydiv">
  <p id="para_1" class="mytext">
    <input type="checkbox" id="check" name="check" value="Paragraph one" checked="checked" />
    <input type="checkbox" id="check" name="check" value="Paragraph one 2" />
  </p>
<script>
  var cached = jQuery('#top').find('p.mytext');
</script>
    

Preparation code output

<style> .clase{ color: "#ff0000"; text-decoration: "underline"; background-color: "#eeeeee"; } </style> <div id="top" class="mydiv"> <p id="para_1" class="mytext"> <input type="checkbox" id="check" name="check" value="Paragraph one" checked="checked" /> <input type="checkbox" id="check" name="check" value="Paragraph one 2" /> </p>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Cached elements
cached.css('color', '#ff0000');
cached.css('text-decoration', 'underline');
cached.css('background-color', '#eeeeee');
pending…
No cache
cached.addClass("clase");
pending…
Cache2
jQuery('#top').find('checkbox.checked')
pending…
Cach3
cached.css({
  "color": "#ff0000",
  "text-decoration": "underline",
  "background-color": "#eeeeee"
});
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.

0 Comments