jQuery Selector Cache

Benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<div id="container"><span><p id="test">Content</p></span></div>
<script>
  var obj = {}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery Manual Cache
var result = obj.test
if (!result) {
 obj.test = $('test');
 result = obj.test;
}
ready
jQuery Auto Cache
var result = $('test');
ready

Revisions

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