arguments performance
JavaScript performance comparison
Info
check Array.prototype.slice vs named arguments
Preparation code
<script>
function arg1(a, b, c) {
return Array.prototype.slice.call(arguments);
}
function arg2(a, b, c) {
var args = [],
l = arguments.length;
while (l--) {
args.push(arguments[l]);
}
return args;
}
function arg3(a, b, c) {
return [a, b, c];
}
function moreArg(a, b, c) {
return [a, b, c, arguments[3], arguments[4]];
}
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
slice arguments |
|
pending… |
arguments2array |
|
pending… |
named args |
|
pending… |
more arguments |
|
pending… |
just use arguments |
|
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. Here’s a list of current revisions for this page:
- Revision 1: published by Kooi
- Revision 2: published by Renzo Kooi
- Revision 3: published by Kooi
- Revision 4: published
- Revision 5: published
- Revision 6: published
- Revision 7: published by Adam Hepton
- Revision 8: published
- Revision 9: published
- Revision 10: published
- Revision 11: published
- Revision 12: published
- Revision 13: published
- Revision 15: published
0 comments