maokai 最近的时间轴更新
maokai

maokai

V2EX 第 536499 号会员,加入于 2021-03-08 05:09:30 +08:00
根据 maokai 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
maokai 最近回复了
@loading 不是,只用了 npm 和 yarn ,连接到国外的源
143 天前
回复了 kebyn 创建的主题 Node.js callback 和 promise 性能差距疑问
哦,对了,你需要把两个 util.promisify 拿到 list_dir 外面来,这样测出的结果差距就小一些了:

❯ time node /tmp/promise.js && sleep 1 && time node /tmp/callback.js
node /tmp/promise.js 0.45s user 0.75s system 142% cpu 0.837 total
node /tmp/callback.js 0.58s user 0.99s system 196% cpu 0.800 total
❯ time node /tmp/promise.js && sleep 1 && time node /tmp/callback.js
node /tmp/promise.js 0.53s user 0.98s system 175% cpu 0.855 total
node /tmp/callback.js 0.38s user 1.00s system 173% cpu 0.794 total
❯ time node /tmp/promise.js && sleep 1 && time node /tmp/callback.js
node /tmp/promise.js 0.55s user 0.98s system 183% cpu 0.835 total
node /tmp/callback.js 0.52s user 0.86s system 173% cpu 0.797 total

❯ time node /tmp/callback.js && sleep 1 && time node /tmp/promise.js
node /tmp/callback.js 0.48s user 0.90s system 173% cpu 0.801 total
node /tmp/promise.js 0.63s user 1.02s system 192% cpu 0.857 total
❯ time node /tmp/callback.js && sleep 1 && time node /tmp/promise.js
node /tmp/callback.js 0.41s user 0.98s system 172% cpu 0.807 total
node /tmp/promise.js 0.59s user 0.89s system 172% cpu 0.857 total
❯ time node /tmp/callback.js && sleep 1 && time node /tmp/promise.js
node /tmp/callback.js 0.42s user 1.05s system 184% cpu 0.798 total
node /tmp/promise.js 0.56s user 0.95s system 177% cpu 0.848 total
143 天前
回复了 kebyn 创建的主题 Node.js callback 和 promise 性能差距疑问
❯ node --version
v14.17.3

❯ time node /tmp/promise.js && time node /tmp/callback.js
node /tmp/promise.js 0.66s user 0.84s system 169% cpu 0.887 total
node /tmp/callback.js 0.42s user 1.13s system 192% cpu 0.806 total
❯ time node /tmp/promise.js && time node /tmp/callback.js
node /tmp/promise.js 0.61s user 0.92s system 169% cpu 0.899 total
node /tmp/callback.js 0.41s user 0.84s system 156% cpu 0.804 total
❯ time node /tmp/promise.js && time node /tmp/callback.js
node /tmp/promise.js 0.46s user 1.03s system 168% cpu 0.886 total
node /tmp/callback.js 0.30s user 0.76s system 134% cpu 0.783 total

❯ time node /tmp/callback.js&& time node /tmp/promise.js
node /tmp/callback.js 0.44s user 0.81s system 160% cpu 0.772 total
node /tmp/promise.js 0.64s user 0.89s system 170% cpu 0.898 total
❯ time node /tmp/callback.js&& time node /tmp/promise.js
node /tmp/callback.js 0.39s user 0.87s system 163% cpu 0.776 total
node /tmp/promise.js 0.58s user 0.92s system 168% cpu 0.885 total
❯ time node /tmp/callback.js&& time node /tmp/promise.js
node /tmp/callback.js 0.36s user 0.93s system 166% cpu 0.777 total
node /tmp/promise.js 0.61s user 0.90s system 170% cpu 0.884 total
关于   ·   帮助文档   ·   API   ·   FAQ   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   3969 人在线   最高记录 5497   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 08:37 · PVG 16:37 · LAX 00:37 · JFK 03:37
♥ Do have faith in what you're doing.