recompiled (optimized) functions in the v8.log

Jun 23, 2014 at 9:48 AM
Hi
Looking at the code of LogConverter I see that the recompiled attr i.e. a function has been optimized , is determined by if a function appears a second time in the v8 log.

bool isRecompilation = !_allMethods.Add(method);

can someone explain this to me please.
thanks.
Coordinator
Jun 23, 2014 at 7:04 PM
What's occurring here is that V8 will sometimes recompile a method in a more optimized form after it has been executed a sufficient number of times. When that happens it writes an additional code-creation event into the log file. After that recompilation methods called by the function may be inlined and so you'll generally find it harder to reason about what's happening in your code. Therefore when we notice that it's happened we add the (recompiled) tag to the function. You can then see both the original method and the recompiled method in the profiler view and have a chance to reason about the recompiled method also including methods which have been inlined.
Jun 24, 2014 at 5:32 AM
Hi Thanks for the reply
  1. I didnt see anywhere that you check that the event is a code-creation event
  2. what happens if V8 decides to de optimize and optimized function after a while (it can happen)
thanks.
Coordinator
Jun 25, 2014 at 5:43 AM
  1. There's a switch block in the Process method which is calling ExtractNamespaceAndMethodName and doing the tracking (and similarly in CreatePdbFile as well).
  2. There's only so much we can do based upon what V8 reports and I'm not sure what the v8 log would look like in that situation. I would assume it would look like a fallback to the original non-optimized method and another compilation event for the re-optimized function. If that is an accurate guess then you'd see additional time spent in the non-optimized version and more time spent in another method of the same name.
We could add a hit count onto these to make it more easy to distinguish what's going on in particular if you know what the log would look like in these cases. And of course you seem like you're getting a good grasp of the converter code so if you'd like to provide any improvements we'd welcome them :)
Jun 25, 2014 at 6:19 AM
cool
I will find some time maybe next week and have a look myself and try and see what can be done.
Excellent job guys. keep it up :-)
Thanks.