I am running nodejs (v8 8.12.0 LTS).
I really want to check optimization about my js code.
so, I executed this command.
node --trace-opt --trace-deopt index.js
or
node --trace-opt --trace-deopt --trace-ic index.js
but, nothing shown.. not any comments on console.
Actually I expected like this.
[deoptimizing (DEOPT eager): begin 0xc6b3e5e7fb9 (opt #0) @1, FP to SP delta: 24, caller sp: 0x7ffe2cde6f40] reading input frame myFunc => node=4, args=2, height=1; inputs: 0: 0xc6b3e5e7fb9 ; [fp - 16] 0xc6b3e5e7fb9 translating frame myFunc => node=4, height=0 0x7ffe2cde6f10: [top + 0] <- 0xc6b3e5e7fb9 ; function 0xc6b3e5e7fb9 (input #0) [deoptimizing (eager): end 0xc6b3e5e7fb9 @1 => node=4, pc=0x30c7754496c6, caller sp=0x7ffe2cde6f40, state=NO_REGISTERS, took 0.047 ms]
but I think it's not working command with v8 options..
Why I can't get this information I expect?
this is my example code.
function myFunc(nb) {
return nb + nb;
}
for (let i = 0; i < 2000; ++i) {
myFunc(i);
}
for (let i = 0; i < 2000; ++i) {
myFunc(i + '');
}
The function myFunc
in your example is so small that 2000 invocations are not enough to trigger optimization for it. Try making it bigger, or calling it more often.