attr vs attrhooks (v6)

Revision 6 of this benchmark created on


Description

Compares the performance of attrhooks vs the old attr

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3/mootools-yui-compressed.js">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/yuiloader/yuiloader-min.js">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js">
</script>
<script src="https://p<script src=" //www.cinsoft.net/mylib099-min.js "></script>
<script src="https://ajax.googleapis.com/ajax/libs/ext-core/3/ext-core.js "></script>
/ajax/libs/jquery/1.5.2/jquery.js">
</script>
<script>
  var oldAttr = jQuery.noConflict();
</script>
<script src="http://code.jquery.com/jquery-1.6.js">
</script>
<script>
  var newAttr = jQuery.noConflict();
</script>
<div id="testDiv">
</div>
<input type="text" id="someInput" value="foo">
<script>
  var oldDiv = oldAttr('#testDiv'),
      oldInput = oldAttr('#someInput'),
      newDiv = newAttr('#testDiv'),
      newInput = newAttr('#someInput');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
oldDiv.attr('id')
oldDiv.attr('id');
ready
newDiv.attr('id')
newDiv.attr('id');
ready
oldInput.attr('value')
oldInput.attr('value');
ready
newInput.attr('value')
newInput.attr('value');
ready
oldDiv.attr('class', 'wowzers')
oldDiv.attr('class', 'wowzers');
ready
newDiv.attr('class', 'wowzers')
newDiv.attr('class', 'wowzers');
ready
oldInput.attr('foo', 'bar')
oldInput.attr('foo', 'bar');
ready
newInput.attr('foo', 'bar')
newInput.attr('foo', 'bar');
ready

Revisions

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