args
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
function stuffFive(a, b, c, d, e) {
var copy = [];
var args = [a, b, c, d, e];
var i = 0;
var v;
while (args[i]) {
copy[i] = args[i];
i++;
}
return copy;
}
function stuffWhatever() {
var copy = [];
var args = arguments;
var i = 0;
var v;
while (args[i]) {
copy[i] = args[i];
i++;
}
return copy;
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
5 : 1 |
|
pending… |
args: 1 |
|
pending… |
5: 2 |
|
pending… |
args: 2 |
|
pending… |
5: 5 |
|
pending… |
args: 5 |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments