Chrome 19 Is 25 Percent Faster in SunSpider Thanks to V8 Update
"V8 has a second, optimizing compiler that generates much faster machine code, but takes much more time to do so, so it has to be used selectively," it added.
The obvious challenge is to find the functions that would benefit from the optimization and discard the rest. Of course, V8 has to do this without interfering with the running code too much.
Currently, in Chrome 18, V8 stops every millisecond, which may seem like a very short amount of time, but code is processed a lot faster than that. When it stops, it analyzes the currently running functions and decides which would benefit the most from optimization.
That works for long-running programs, but short functions, which may be used often, don't get optimized.
As of Chrome 19, V8 analyzes scripts more often and in greater detail to make more informed decision on what to optimize.