jquery-append-options-to-select
JavaScript performance comparison
Info
The goal is to populate a select with the options available in an array, and one selected value.
Read more about jQuery append with an array as first argument
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
Benchmark.prototype.setup = function() {
var options = [1, 3, 4, 6, 12],
selected = 3,
$select = $('<select></select>');
};
Benchmark.prototype.teardown = function() {
$select = $('<select></select>');
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
each-append-to |
|
pending… |
each-append |
|
pending… |
each-append-string |
|
pending… |
append-map-jq |
|
pending… |
append-map-string-join |
|
pending… |
append-apply-map-string |
|
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. Here’s a list of current revisions for this page:
- Revision 1: published by Dan Manastireanu
- Revision 2: published
0 comments