解释 node.js 探查器结果中的 * 和 ~
Interpreting * and ~ in node.js profiler results
我正在使用 v8 分析器分析我的 Node.js 程序,使用 this article 中的步骤,基本上:
# run program with profiler, generating isolate-nnnnnnnnn-v8.log
node --prof myprogram.js
# process tick profiler file
node --prof-process isolate-nnnnnnnnn-v8.log > processed.txt
在processed.txt
中,每种类型的代码(JS、C++等)中都有一个函数调用部分。对于 JavaScript 部分中列出的许多函数(比如 someFunction
),我看到了 *someFunction
和 ~someFunction
:
的条目
[JavaScript]:
ticks total nonlib name
490 2.4% 2.5% LazyCompile: *someFunction pathToFile.js
80 0.4% 0.4% LazyCompile: ~someFunction pathToFile.js
谁能告诉我函数名前面的*
和~
(星号和波浪号)是什么意思? 基于this page, *
可能意味着该功能已优化,但我不确定,因为它在不同的上下文中提到。
正确。 *
(星号)表示 Turbofan 已优化该功能。 ~
(波浪号)意味着它的一个假设是不正确的,它必须取消优化函数,或者它没有时间优化或者函数非常冷(很少 运行)因此没有尝试。
您还可以在 运行 节点查看背后的推理时使用 --trace-opt
和 --trace-deopt
标志。
我正在使用 v8 分析器分析我的 Node.js 程序,使用 this article 中的步骤,基本上:
# run program with profiler, generating isolate-nnnnnnnnn-v8.log
node --prof myprogram.js
# process tick profiler file
node --prof-process isolate-nnnnnnnnn-v8.log > processed.txt
在processed.txt
中,每种类型的代码(JS、C++等)中都有一个函数调用部分。对于 JavaScript 部分中列出的许多函数(比如 someFunction
),我看到了 *someFunction
和 ~someFunction
:
[JavaScript]:
ticks total nonlib name
490 2.4% 2.5% LazyCompile: *someFunction pathToFile.js
80 0.4% 0.4% LazyCompile: ~someFunction pathToFile.js
谁能告诉我函数名前面的*
和~
(星号和波浪号)是什么意思? 基于this page, *
可能意味着该功能已优化,但我不确定,因为它在不同的上下文中提到。
正确。 *
(星号)表示 Turbofan 已优化该功能。 ~
(波浪号)意味着它的一个假设是不正确的,它必须取消优化函数,或者它没有时间优化或者函数非常冷(很少 运行)因此没有尝试。
您还可以在 运行 节点查看背后的推理时使用 --trace-opt
和 --trace-deopt
标志。