Option.add vs Element.appendChild
JavaScript performance comparison
Info
Stackoverflow - http://stackoverflow.com/q/8377498/918414
Preparation code
<select name="mois" id="mois"></select>
<script>
Benchmark.prototype.setup = function() {
var month = [
"Janvier","Février","Mars","Avril","Mai","Juin",
"Juillet","Aout","Septembre","Octobre","Novembre","Décembre"
];
};
Benchmark.prototype.teardown = function() {
document.getElementById( 'mois' ).innerHTML = '';
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Option.add |
|
pending… |
Element.appendChild |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments