arraycopy
JavaScript performance comparison
Info
Testing different ways of copying arrays.
Preparation code
<script>
Benchmark.prototype.setup = function() {
var dstAry = []
var srcAry1 = ["abcdefghi", "jklmnopqrstuv", "wxyz"]
var srcAry2 = ["zyxwvut"]
var srcAry3 = ["srqponml", "kjihgfedcba"]
function inPlace(dst, src) {
dst.length = src.length
for (var i = 0, len = src.length; i < len; i++) {
dst[i] = src[i]
}
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Slice |
|
pending… |
In Place |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments