alsotang / node-lessons

:closed_book:《Node.js 包教不包会》 by alsotang
16.54k stars 4.7k forks source link

benchmark结果不同 #123

Open Happy-xiaoxi opened 7 years ago

Happy-xiaoxi commented 7 years ago

同样的代码,为什么我一直运行的是+最快,是因为node和浏览器运行方式不一样的缘故吗? + x 67,830,632 ops/sec ±2.27% (82 runs sampled) parseInt x 48,760,129 ops/sec ±2.45% (77 runs sampled)
Number x 51,682,803 ops/sec ±7.15% (65 runs sampled) Fastest is +

alsotang commented 7 years ago

这issue对应哪个lesson?

2017-02-14 23:05 GMT+08:00 xiaoC notifications@github.com:

同样的代码,为什么我一直运行的是+最快,是因为node和浏览器运行方式不一样的缘故吗?

  • x 67,830,632 ops/sec ±2.27% (82 runs sampled) parseInt x 48,760,129 ops/sec ±2.45% (77 runs sampled) Number x 51,682,803 ops/sec ±7.15% (65 runs sampled) Fastest is +

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/alsotang/node-lessons/issues/123, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGB74oEBOFy37SazhGx9T0SrTE4dkoGks5rccKwgaJpZM4MAlTy .

-- GitHub: https://github.com/alsotang

Happy-xiaoxi commented 7 years ago

哦,抱歉,这个是lesson10 的内容

alsotang commented 7 years ago

可能当时 node 0.12 版本跟现在的版本有差异吧。

https://github.com/alsotang/fast-js 根据我这里的数据来看,+会更快。

Happy-xiaoxi commented 7 years ago

好的,谢谢,我还以为自己弄错了点什么 ^^