array-concat-vs-custom
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
function concatList(list, otherList) {
var pad = list.length, length = otherList.length;
while (length--) list[pad + length] = otherList[length];
return list;
}
function nativeConcat(list, otherList) {
return list.concat(otherList);
}
var array2 = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
native concat |
|
pending… |
custom |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments