thlorenz / deoptigate

⏱️ Investigates v8/Node.js function deoptimizations.
https://nodesource.github.io/deoptigate-examples/xml2js/01_start/?selectedFileIdx=31&selectedLocation=157&includeAllSeverities=false&highlightCode=true&selectedTabIdx=1&selectedSummaryTabIdx=1
MIT License
1.16k stars 22 forks source link

What does optimizable state means under optimization state? #28

Open kaushik143 opened 3 years ago

kaushik143 commented 3 years ago

I am using deoptigate to find out bottlenecks for my node application and I see a lot of functions in an optimizable state but I don't understand if this is a bottleneck or not. Since I expect the function to be in an optimized state if it is not a bottleneck.

Attaching screenshot for optimizable state

Screenshot 2021-03-24 at 5 25 58 PM

Similarly, under inline-cache grouping, I see dynamic key access as megamorphism but that also I am not sure if it is bottleneck. Here is the definition of function const getResponseHeaders = (▲response, key) => response[☎'_headers'][☎key]; It shows problem at '_headers' and 'key' and key here is string which get 2 different values

Please help me understand properly that How to use this in a better way. I read this blog multiple times and it is really helpful in the case of deoptimization but nothing is mention for these two 2 other grouping.

jolindroth commented 2 years ago

Optimizable means that the function can be optimized, but the compiler has not yet found it worthwhile to optimize the method. It is not a bottleneck. However, if you have megamorphic property access sites then you should look into if you can avoid mutating the properties of the input object. That property will be unnecessarily slow to access.