user friendliness overhead for remove attr (v2)

Revision 2 of this benchmark created by John Bender on


Description

These tests are meant to examine the benefits of removing user friendliness features in favor of performance. The test subject is $.removeAttr.

Preparation HTML

<script src="https://code.jquery.com/jquery-1.7.2.js"></script>
<script src="https://raw.github.com/johnbender/auto-jquery-optimization-paper/master/perf/removeattr/removeAttr.js"></script>
<script>
window.testElementCount = 10;
</script>
<script src="https://raw.github.com/johnbender/auto-jquery-optimization-paper/master/perf/removeattr/setup.js"></script>

Setup

// 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");

Test runner

Ready to run.

Testing in
TestOps/sec
friendly
window.testSet
  .removeAttr( "foo" )
  .removeAttr( "bar" )
  .removeAttr( "baz" );
 
ready
unfriendly
window.testSet
  .removeAttrSimple( "foo" )
  .removeAttrSimple( "bar" )
  .removeAttrSimple( "baz" );
 
ready

Revisions

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

  • Revision 2: published by John Bender on