Array unshift vs splice
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var array = new Array(1e3);
for (var i = 0, n = array.length; i < n; ++i) {
array[i] = i;
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test | Ops/sec | |
---|---|---|
Array.unshift
|
|
pending… |
Array.splice
|
|
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 Mike Petrovich
- Revision 2: published
- Revision 3: published
- Revision 4: published
- Revision 5: published hight3ch
- Revision 6: published Samuel
- Revision 7: published
0 Comments