Cache object

JavaScript performance comparison

Revision 3 of this test case created by

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div class="search-results"></div>
      
<script>
Benchmark.prototype.setup = function() {
  var data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  var $search = $('.search-results');

};
</script>

Preparation code output

<div class="search-results"></div>

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
Without caching
$('.search-results').addClass('visible');

for (var i = 0; i < data.length; i++) {
  $('.search-results').append('<span>' + data[i] + '</span>');
}
pending…
With caching
$search.addClass('visible');

for (var i = 0; i < data.length; i++) {
  $search.append('<span>' + data[i] + '</span>');
}
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