javascript的函数中的函数的性能
简单做了一个例子可以看到性能效果:
function F(){
FF()
}
function FF(){}
var start = new Date
for(i=0; i<100000; i++){
F()
}
var span = new Date - start
alert(span) //661
function F(){
FF()
function FF(){}
}
var start = new Date
for(i=0; i<100000; i++){
F()
}
var span = new Date - start
alert(span) //1211
FF()
}
function FF(){}
var start = new Date
for(i=0; i<100000; i++){
F()
}
var span = new Date - start
alert(span) //661
function F(){
FF()
function FF(){}
}
var start = new Date
for(i=0; i<100000; i++){
F()
}
var span = new Date - start
alert(span) //1211