Okay, so Mr. Bench here tests how fast v8 handles:
var args = Array.prototype.slice.call(arguments);
var i = arguments.length, args = new Array(i); while(i--) args[i] = arguments[i];
However he is a wired judge, hE wilL noT leT V8 optimizE!.
The results are:
slice call: 12.2983 ms (avg) 2.01± while loop: 15.6222 ms (avg) 1.46± slice call: 11.9533 ms (avg) 1.46± while loop: 15.7101 ms (avg) 1.55± slice call: 11.7302 ms (avg) 2.02± while loop: 15.5891 ms (avg) 1.54± slice call: 11.8409 ms (avg) 1.16± while loop: 15.6987 ms (avg) 1.31± slice call: 11.9382 ms (avg) 1.76± while loop: 15.5833 ms (avg) 1.40± slice call: 12.2972 ms (avg) 2.85± while loop: 18.3039 ms (avg) 5.91±
And oh, shit! The
slice.call was somehow faster.
So I know for a fact that a while is faster than
Array.prototype.slice.call because of the way v8 optimize, actually it is quite significant. See http://jsperf.com/argument-slicing (or something like that, or better yet test it your self in a real world case!).
But people are using too much time on this debate, there must be more important things there matters. That why I use the "could be more funny, but I did an attempt" dictionary.
I wrote this just after https://github.com/joyent/node/pull/3676#discussion_r1307666, and yes I do know that the cool guys ment it as a partial joke, I appreciate it!
Thats because V8 optimization takes time and the time spent on optimization is just as important as time spent on compiling and execution. It all counts!. V8 will therfore (and for other reasons) not optimize at the first encounter, but as time pass, v8 will based on history progressively optimize the code.
In this benchmark a new v8 instance is booted on each run, v8 has therefor no history and it won't optimize. The conditions are therefor not the same, as in traditional benchmarks where the code is executed a lot and v8 will attempt to optimize it.
This part is almost pure guess:
Array.slice has a studs. However
Don't make the discussion too serious please, seriously!
And checkout http://www.youtube.com/watch?v=UJPdhx5zTaw for actual facts.