Remove attr composed vs chained simple methods

JavaScript performance comparison

Revision 2 of this test case created by John Bender


This tests the performance of a vanilla chain of $.fn.removeAttr against the performance of a composed version of the underlying $.removeAttr.

Preparation code

<script src="//"></script>
<script src=""></script>
window.testElementCount = 20;
<script src=""></script>
Benchmark.prototype.setup = function() {
    // cache the test sets
    window.testSetDivs = $( "[data-test]" );
    // add the attribute and data to be removed
      .attr("foo", "bar")
      .attr("bing", "bang")
      .data( "baz", "bak" );

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Vanilla chain with two $.fn.removeAttr
window.testSetDivs.removeAttr( "foo" ).removeAttr( "bing" );
Composition of two $.removeAttr
window.testSetDivs.cleanUpJustAttrs( "foo", "bing" );

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

1 comment

Leistungen Krankenkassen commented :

I do not know if it's just me or if perhaps everybody else experiencing problems with your site. It appears like some of the text within your content are running off the screen. Can somebody else please comment and let me know if this is happening to them too?

This may be a issue with my internet browser because I've had this happen before. Thanks

Add a comment