attr vs attrhooks (v3)

Revision 3 of this benchmark created on


Description

Compares the performance of attrhooks (v1.7) vs the old attr (1.4.3)

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.js"></script>
<script>
var oldAttr = jQuery.noConflict();
</script>
<script src="http://code.jquery.com/jquery-1.7.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.