additional function call overhead for remove attr

JavaScript performance comparison

Revision 3 of this test case created by John Bender

Preparation code

<script src="https://code.jquery.com/jquery-1.7.2.js"></script>
<script src="https://raw.github.com/johnbender/applications-cat-theory/master/perf/removeattr/removeAttr.js"></script>
<script>
window.testElementCount = 10;
</script>
<script src="https://raw.github.com/johnbender/applications-cat-theory/master/perf/removeattr/setup.js"></script>
      
<script>
Benchmark.prototype.setup = function() {
  // cache the test sets
  window.testSet = $( "[data-test]" );
  
  // add the attribute and data to be removed
  window.testSet
    .attr("foo", "bar")
    .attr("bar", "bang")
    .attr("baz", "bak");
  

};
</script>

Preparation code output

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
inlined
window.testSet
  .removeAttr( "foo" )
  .removeAttr( "bar" )
  .removeAttr( "baz" );
pending…
abstracted
window.testSet
  .removeAttrWithCall( "foo" )
  .removeAttrWithCall( "bar" )
  .removeAttrWithCall( "baz" );
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