'What are the "bytes touched" in V8 Parse processor?

I recently started to play around with V8 parse processor, and found there was something called bytes touched along the graph. what does it mean?

And when i tried to apply the IIFE heuristics to eager parse my function, i found that the pre-parse time was reduced. What happens in the pre-parse time? Also, what are the these terminologies such as baseline time, resolution time and nesting level mean?

Even though I executed the function, it still shows up as "non-executed" in parse time. Why is it so?

Parse processor graph



Solution 1:[1]

What are the "bytes touched" in V8 Parse processor?

The number of bytes seen/processed by the parser or preparser. (I don't know why it would ever be negative, that seems surprising; but maybe there's a good reason for it.)

What happens in the pre-parse time?

Preparsing is the initial quick pass over code that will be lazy-compiled later. It's required in order to:

  • find out which functions exist, and where in the source they are
  • find out which variables from their outer scopes they refer to, so that these variables can be context-allocated
  • throw "early errors" as required by the JS spec
  • and maybe a few other things that I'm not thinking of right now.

For functions that will be eagerly compiled immediately, preparsing can be skipped. Usually it's beneficial to preparse and lazy-compile though (so any future readers of this: please don't feel tempted to minimize preparsing time, that'd most likely be counter-productive!).

what are the these terminologies such as baseline time, resolution time and nesting level mean?

"baseline time": time for baseline (non-optimized) compilation
"resolution time": time for variable resolution
"nesting level": when a function is defined inside another function, they're "nested". Obviously this can go many levels deep.

Even though I executed the function, it still shows up as "non-executed" in parse time. Why is it so?

Because tracking executed functions in the Parse Profiler is currently not implemented, apparently because nobody needed it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jmrk