Unshift item inside an array
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var arr = [1, 2, 3, 4, 5, 6, 7];
function fn_unshift() {
arr.unshift(0);
return arr;
}
function fn_concat_init() {
return [0].concat(arr)
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test | Ops/sec | |
---|---|---|
Add element at the init of Array with unshift()
|
|
pending… |
Add element at the init of Array with concat()
|
|
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.
- Revision 1: published joel
- Revision 4: published
- Revision 5: published
- Revision 6: published
- Revision 7: published
- Revision 8: published
- Revision 9: published mvedie
- Revision 10: published mvedie
- Revision 11: published mvedie
- Revision 12: published kev
0 Comments