jQuery 1.5b clone

Benchmark created by Dan Heberden on


Description

Why oh why is jQuery 1.5b treating us this way. We have been so loving to it.

Preparation HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script>
    var $14 = jQuery.noConflict();
</script>
<script src="http://code.jquery.com/jquery-1.5b1.js"></script>
<script>
    var $15 = jQuery;
</script>

<div id="jq144" style="display:none;"></div>
<div id="jq150" style="display:none;" ></div>
<script>
  var thismany = 500,
      $divs = $(false),
      containers = ["jq144", "jq150"];
  
  while (thismany--) {
   $divs.push($('<div/>')[0]);
  }
  
  for (var i = 0; i < containers.length; i++) {
   $("#" + containers[i]).append($divs.clone());
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery 1.4.4 clone - false
$14('#jq144').children().each(function() {
 $14(this).clone();
});
ready
jQuery 1.5b clone - false
$15('#jq150').children().each(function() {
 $15(this).clone();
});
ready
jQuery 1.4.4 clone - true
$14('#jq144').children().each(function() {
 $14(this).clone(true);
});
ready
jQuery 1.5b clone - true
$15('#jq150').children().each(function() {
 $15(this).clone(true);
});
ready

Revisions

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

  • Revision 1: published by Dan Heberden on