问题描述
Chrome 与 Firefox。当前版本。在关闭附加组件的情况下进行测试。也刷新了 Firefox。
function measureLoopSpeed() {
var count = 0
function addOne() { count = count + 1 }
// Date.Now() returns a big number representing the number of
// milliseconds that have elapsed since Jan 01 1970
var Now = Date.Now()
// Loop until Date.Now() is 1000 milliseconds (1 second) or more into
// the future from when we started looping. On each loop,call addOne
while (Date.Now() - Now < 1000) addOne()
// Finally it has been >= 1000ms,so let's print out our total count
console.log(count)
}
undefined
//On Firefox console
measureLoopSpeed()
4227461 debugger eval code:14:11
undefined
measureLoopSpeed()
4103189 debugger eval code:14:11
undefined
//On Chrome console
undefined
measureLoopSpeed()
11193127
undefined
measureLoopSpeed()
11153367
undefined
measureLoopSpeed()
11159575
*** 1 秒内完成的总任务甚至比不上 chrome 1 秒内完成的任务。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)