JS in Chrome(V8)的性能问题

Fla*_*let 7 javascript arrays performance google-chrome

我有以下简单的代码:

var objTest = function(){
    this.recupOpt = function(){
        return [1, 2];
    };

    this.recup = function(){
        return new Array(1,2);
    };
};
Run Code Online (Sandbox Code Playgroud)

根据个人测试和http://jsperf.com/performance-js-chrome-array,我观察到方法recupOpt比recup一个慢(至少在Chrome中,在Firefox中类似的性能)对象创建.

我对这样的结果感到非常惊讶,因为我已经阅读到处[]比新数组更有效,因为这种语法专用于数组创建.

但是,当我只执行一次分配时,我只测试调用,[](http://jsperf.com/performance-js-chrome-array-2)的性能更好.

看来调用recupOpt在从新对象调用时花费更多,但是当这个对象已被多次使用时效率更高.

你知道这些结果的原因吗?

谢谢