.add for inserting select options vs .join

Benchmark created by Nick on


Preparation HTML

<script src="http://code.jquery.com/jquery-1.11.0-beta2.min.js"></script>
<select id="selectList"></select>

Setup

var options = ['i1', 'i2', 'i3', 'i4', 'i5', 'i6', 'i7', 'i8', 'i9', 'i10', 'i11', 'i12', 'i13', 'i14', 'i15', 'i16', 'i17', 'i18', 'i19', 'i20];

Test runner

Ready to run.

Testing in
TestOps/sec
loop with new Option
var c
ready
loop string add
 
ready
insert all ops with jquery
 
ready
createElement using document fragment
 
ready
join string array and jquery .html
 
ready
pure jquery
 
ready

Revisions

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