学堂学堂学堂公众号手机端

Node.js 异步程序运行结果及分析

nianxian1年前 (2023-07-19)阅读数 169#社会

源程序见: https://www.cnblogs.com/fitmap/p/16915027.html

运行结果:

2022-11-23T02:14:04.688Z Start main
2022-11-23T02:14:04.690Z Start promise main
2022-11-23T02:14:04.690Z Start prepare
2022-11-23T02:14:04.690Z Start promise every_0
2022-11-23T02:14:04.691Z Stop promise every_0 0.1042ms
2022-11-23T02:14:04.691Z Start promise every_1
2022-11-23T02:14:04.691Z Stop promise every_1 0.0054ms
2022-11-23T02:14:04.691Z Start promise every_2
2022-11-23T02:14:04.691Z Stop promise every_2 0.0036ms
2022-11-23T02:14:04.691Z Start promise every_3
2022-11-23T02:14:04.691Z Stop promise every_3 0.0107ms
2022-11-23T02:14:04.691Z Start promise every_4
2022-11-23T02:14:04.691Z Stop promise every_4 0.0038ms
2022-11-23T02:14:04.691Z Start promise every_5
2022-11-23T02:14:04.691Z Stop promise every_5 0.0072ms
2022-11-23T02:14:04.692Z Start promise every_6
2022-11-23T02:14:04.692Z Stop promise every_6 0.005ms
2022-11-23T02:14:04.692Z Start promise every_7
2022-11-23T02:14:04.692Z Stop promise every_7 0.004ms
2022-11-23T02:14:04.692Z Start promise every_8
2022-11-23T02:14:04.692Z Stop promise every_8 0.004ms
2022-11-23T02:14:04.692Z Start promise every_9
2022-11-23T02:14:04.692Z Stop promise every_9 0.011ms
2022-11-23T02:14:04.692Z Stop prepare 1.6465ms
2022-11-23T02:14:04.692Z Start every
2022-11-23T02:14:04.692Z Start await every_0
2022-11-23T02:14:04.692Z Start prepare
2022-11-23T02:14:04.692Z Start promise unify_0
2022-11-23T02:14:04.692Z Stop promise unify_0 0.0033ms
2022-11-23T02:14:04.692Z Start promise unify_1
2022-11-23T02:14:04.693Z Stop promise unify_1 0.0033ms
2022-11-23T02:14:04.693Z Start promise unify_2
2022-11-23T02:14:04.693Z Stop promise unify_2 0.0025ms
2022-11-23T02:14:04.693Z Start promise unify_3
2022-11-23T02:14:04.693Z Stop promise unify_3 0.0022ms
2022-11-23T02:14:04.693Z Start promise unify_4
2022-11-23T02:14:04.693Z Stop promise unify_4 0.0022ms
2022-11-23T02:14:04.693Z Start promise unify_5
2022-11-23T02:14:04.693Z Stop promise unify_5 0.0051ms
2022-11-23T02:14:04.693Z Start promise unify_6
2022-11-23T02:14:04.693Z Stop promise unify_6 0.0063ms
2022-11-23T02:14:04.693Z Start promise unify_7
2022-11-23T02:14:04.693Z Stop promise unify_7 0.0023ms
2022-11-23T02:14:04.693Z Start promise unify_8
2022-11-23T02:14:04.693Z Stop promise unify_8 0.0026ms
2022-11-23T02:14:04.693Z Start promise unify_9
2022-11-23T02:14:04.693Z Stop promise unify_9 0.0025ms
2022-11-23T02:14:04.693Z Stop prepare 0.7488ms
2022-11-23T02:14:04.693Z Start await unify
2022-11-23T02:14:04.693Z Stop promise main 3.0417ms
2022-11-23T02:14:04.693Z Start await main
2022-11-23T02:14:04.694Z Start busy_every_0
2022-11-23T02:14:04.704Z Stop busy_every_0 9.5699ms result=3671
2022-11-23T02:14:04.704Z Start busy_every_1
2022-11-23T02:14:04.713Z Stop busy_every_1 9.2686ms result=3640
2022-11-23T02:14:04.724Z Start busy_every_2
2022-11-23T02:14:04.728Z Stop busy_every_2 4.2771ms result=3666
2022-11-23T02:14:04.728Z Start busy_every_3
2022-11-23T02:14:04.733Z Stop busy_every_3 4.8357ms result=3662
2022-11-23T02:14:04.733Z Start busy_every_4
2022-11-23T02:14:04.738Z Stop busy_every_4 4.3268ms result=3691
2022-11-23T02:14:04.738Z Start busy_every_5
2022-11-23T02:14:04.742Z Stop busy_every_5 4.6036ms result=3643
2022-11-23T02:14:04.743Z Start busy_every_6
2022-11-23T02:14:04.747Z Stop busy_every_6 4.5553ms result=3717
2022-11-23T02:14:04.747Z Start busy_every_7
2022-11-23T02:14:04.752Z Stop busy_every_7 4.3657ms result=3640
2022-11-23T02:14:04.752Z Start busy_every_8
2022-11-23T02:14:04.756Z Stop busy_every_8 4.4664ms result=3696
2022-11-23T02:14:04.756Z Start busy_every_9
2022-11-23T02:14:04.760Z Stop busy_every_9 4.124ms result=3746
2022-11-23T02:14:04.760Z Start busy_unify_0
2022-11-23T02:14:04.765Z Stop busy_unify_0 4.6891ms result=3621
2022-11-23T02:14:04.765Z Start busy_unify_1
2022-11-23T02:14:04.770Z Stop busy_unify_1 4.4502ms result=3686
2022-11-23T02:14:04.770Z Start busy_unify_2
2022-11-23T02:14:04.774Z Stop busy_unify_2 4.0361ms result=3669
2022-11-23T02:14:04.774Z Start busy_unify_3
2022-11-23T02:14:04.778Z Stop busy_unify_3 4.4638ms result=3694
2022-11-23T02:14:04.778Z Start busy_unify_4
2022-11-23T02:14:04.783Z Stop busy_unify_4 4.2759ms result=3623
2022-11-23T02:14:04.783Z Start busy_unify_5
2022-11-23T02:14:04.787Z Stop busy_unify_5 4.1593ms result=3687
2022-11-23T02:14:04.787Z Start busy_unify_6
2022-11-23T02:14:04.791Z Stop busy_unify_6 4.1181ms result=3746
2022-11-23T02:14:04.791Z Start busy_unify_7
2022-11-23T02:14:04.796Z Stop busy_unify_7 4.7875ms result=3721
2022-11-23T02:14:04.796Z Start busy_unify_8
2022-11-23T02:14:04.800Z Stop busy_unify_8 4.2299ms result=3730
2022-11-23T02:14:04.800Z Start busy_unify_9
2022-11-23T02:14:04.805Z Stop busy_unify_9 4.0764ms result=3716
2022-11-23T02:14:04.805Z Stop await every_0 112.422ms
2022-11-23T02:14:04.805Z Start await every_1
2022-11-23T02:14:04.805Z Stop await every_1 0.0152ms
2022-11-23T02:14:04.805Z Start await every_2
2022-11-23T02:14:04.805Z Stop await unify 111.4805ms result=3621,3686,3669,3694,3623,3687,3746,3721,3730,3716
2022-11-23T02:14:04.805Z Stop await every_2 0.0424ms
2022-11-23T02:14:04.805Z Start await every_3
2022-11-23T02:14:04.805Z Stop await every_3 0.0033ms
2022-11-23T02:14:04.805Z Start await every_4
2022-11-23T02:14:04.805Z Stop await every_4 0.0026ms
2022-11-23T02:14:04.805Z Start await every_5
2022-11-23T02:14:04.805Z Stop await every_5 0.0023ms
2022-11-23T02:14:04.805Z Start await every_6
2022-11-23T02:14:04.805Z Stop await every_6 0.0025ms
2022-11-23T02:14:04.805Z Start await every_7
2022-11-23T02:14:04.805Z Stop await every_7 0.0024ms
2022-11-23T02:14:04.805Z Start await every_8
2022-11-23T02:14:04.805Z Stop await every_8 0.0023ms
2022-11-23T02:14:04.805Z Start await every_9
2022-11-23T02:14:04.805Z Stop await every_9 0.0023ms
2022-11-23T02:14:04.805Z Stop every 113.0735ms result=3671,3640,3666,3662,3691,3643,3717,3640,3696,3746
2022-11-23T02:14:04.805Z Stop await main 111.7481ms
2022-11-23T02:14:04.805Z Stop main 115.1154ms

分析:

共提交 21 份承诺: main, every_0~9, unify_0~9
共等待 12 份兑现: every_1~9, unify(合并了0~9), main
这些异步承诺按提交的顺序逐个执行, 合并等待承诺兑现能较早完成.

TRANSLATE with x

English

ArabicHebrewPolish
BulgarianHindiPortuguese
CatalanHmong DawRomanian
Chinese SimplifiedHungarianRussian
Chinese TraditionalIndonesianSlovak
CzechItalianSlovenian
DanishJapaneseSpanish
DutchKlingonSwedish
EnglishKoreanThai
EstonianLatvianTurkish
FinnishLithuanianUkrainian
FrenchMalayUrdu
GermanMalteseVietnamese
GreekNorwegianWelsh
Haitian CreolePersian


TRANSLATE with

COPY THE URL BELOW

Back

EMBED THE SNIPPET BELOW IN YOUR SITE

Enable collaborative features and customize widget: Bing Webmaster Portal
Back


此页面的语言为弗里西语


翻译为中文(简体)



  • 中文(简体)
  • 中文(繁体)
  • 丹麦语
  • 乌克兰语
  • 乌尔都语
  • 亚美尼亚语
  • 俄语
  • 保加利亚语
  • 克罗地亚语
  • 冰岛语
  • 加泰罗尼亚语
  • 匈牙利语
  • 卡纳达语
  • 印地语
  • 印尼语
  • 古吉拉特语
  • 哈萨克语
  • 土耳其语
  • 威尔士语
  • 孟加拉语
  • 尼泊尔语
  • 布尔语(南非荷兰语)
  • 希伯来语
  • 希腊语
  • 库尔德语
  • 德语
  • 意大利语
  • 拉脱维亚语
  • 挪威语
  • 捷克语
  • 斯洛伐克语
  • 斯洛文尼亚语
  • 旁遮普语
  • 日语
  • 普什图语
  • 毛利语
  • 法语
  • 波兰语
  • 波斯语
  • 泰卢固语
  • 泰米尔语
  • 泰语
  • 海地克里奥尔语
  • 爱沙尼亚语
  • 瑞典语
  • 立陶宛语
  • 缅甸语
  • 罗马尼亚语
  • 老挝语
  • 芬兰语
  • 英语
  • 荷兰语
  • 萨摩亚语
  • 葡萄牙语
  • 西班牙语
  • 越南语
  • 阿塞拜疆语
  • 阿姆哈拉语
  • 阿尔巴尼亚语
  • 阿拉伯语
  • 韩语
  • 马尔加什语
  • 马拉地语
  • 马拉雅拉姆语
  • 马来语
  • 马耳他语
  • 高棉语

随时将弗里西语翻译为中文(简体)PRO
一律不翻译弗里西语
一律不翻译i.cnblogs.com

版权声明

本文仅代表作者观点,不代表xx立场。
本文系作者授权xx发表,未经许可,不得转载。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门