I'm profiling my Node.js program with the v8 profiler using the steps in this article, basically:
# 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
In processed.txt
, there's a section for function calls in each type of code (JS, C++, etc). For many functions listed in the JavaScript section (say someFunction
), I see entries for *someFunction
and ~someFunction
:
[JavaScript]:
ticks total nonlib name
490 2.4% 2.5% LazyCompile: *someFunction pathToFile.js
80 0.4% 0.4% LazyCompile: ~someFunction pathToFile.js
Can anyone tell me what the *
and ~
(asterisk and tilde) in front of the function name mean? Based on this page, the *
might mean that the function was optimized, but I'm not sure since it's mentioned in a different context.
Correct. The *
(asterick) indicates Turbofan has optimized the function. The ~
(tilde) means either one of its assumptions were incorrect, and it had to deoptimize the function, or it has not had time to optimize or the function is extremely cold (rarely run) and therefore isn't attempting.
You can also use --trace-opt
and --trace-deopt
flags when running node to see reasoning behind.