[問題] 為什麼node比chrome快?
{
console.time("loop");
for (var i = 0; i < 1000000; i += 1){
// Do nothing
}
console.timeEnd("loop");
}
在網路上看到 ( https://www.toptal.com/nodejs/interview-questions )
說上面這段code
node的執行速度會比chrome瀏覽器快
雖然都是用v8引擎
原因是
因為i是global,會被綁在window object上
然後會
repeatedly resolving the property i within the heavily populated
window namespace in each iteration of the for loop.
上面這句英文理解不能
可以請大大開釋一下嗎?
感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 72.203.67.221
※ 文章網址: https://www.ptt.cc/bbs/Ajax/M.1478935207.A.AE8.html
推
11/12 16:09, , 1F
11/12 16:09, 1F
→
11/12 16:09, , 2F
11/12 16:09, 2F
→
11/12 16:12, , 3F
11/12 16:12, 3F
→
11/12 16:12, , 4F
11/12 16:12, 4F
→
11/12 16:13, , 5F
11/12 16:13, 5F
→
11/12 16:13, , 6F
11/12 16:13, 6F
推
11/12 16:30, , 7F
11/12 16:30, 7F
→
11/12 16:41, , 8F
11/12 16:41, 8F
推
11/12 17:41, , 9F
11/12 17:41, 9F
→
11/12 22:58, , 10F
11/12 22:58, 10F
推
11/13 18:13, , 11F
11/13 18:13, 11F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章