When running JS scripts in Chromes' Performance tab, I see there are three steps for JS interpretation: Parse
, Compile
and Evaluate
.
Sometimes I just see Evaluate
, sometimes Compile
and Evaluate
and sometimes it's the whole three.
My questions are:
Parse
is missing)The Timeline shows what is going on with your website in each frame. To be able to visually identify what was going on when you profiled your website, Timeline is painted in different colors. JavaScript execution time is marked in yellow and it's called Scripting.
Detects time intervals when user was idle or locked system and displays their durations.
Parse:
The js engine goes over the code, determines all the different scopes, variable declarations etc. and sorts them. At this step also hoisting happens. Basically your plain text sourcecode is turned into an Abstract Syntax Tree (AST)
Compile:
Chromes V8 uses JIT compiling, that means that some parts of the js code are transfered into bytecode (that runs directly on your processor without any layer of abstraction inbetween). This increases performance. Sometimes it may decide to run the code directly without compiling it, e.g. if compiling it takes longer than actually running it unoptimized so there would be no benefit whatsoever.
Evaluating:
The code is run.
Read on:
How V8 optimizes
Bytecode vs. Running directly
All together
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With