Single jQuery Object vs.multiple calls to .add()

Benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<button id="button1">
  Button1
</button>
<br>
<button id="button2">
  Button1
</button>
<br>
<button id="button3">
  Button1
</button>
<br>

Setup

var obj = {
      a: "1",
      b: "2",
      c: "3"
    };

Test runner

Ready to run.

Testing in
TestOps/sec
Single jQuery object
$('#button' + obj.a + ', #button' + obj.b + ', #button' + obj.c).css({
  'text-decoration': 'blink',
  'color': '#4ECFBD'
});
ready
.add with multiple jQuery objects
$('#button'+obj.a)
    .add('#button'+obj.b)
    .add('#button'+obj.c)
    .css({'text-decoration':'blink','color':'#4ECFBD'});
ready

Revisions

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