DescriptionLower priority of async scripts
All scripts currently load at a medium priority and compete with each
other for resources. Async scripts do not block the parser and should be
loaded at a lower priority than those that do.
This patch lowers the priority of scripts with async or defer attributes
and scripts that were injected dynamically to load at a "low" priority
which is below blocking scripts but above (non-visible) images.
Visible images are loaded at the same priority but with a higher
intra-priority based on the screen area they cover so visible images
can preempt async scripts once layout is done (a good thing).
We want to keep scripts at a higher priority than (non-visible) images
for a couple of reasons:
1 - Scripts may cause other resource loads while images do not
(generally). There is potential to push out the onload time of the page
if a script with lots of follow-on content is loaded at the end after
images.
2 - By the time the code executes to inject the script the preload
parser may have already discovered the bulk of the images on the page.
Test results: https://docs.google.com/spreadsheet/ccc?key=0As3TLupYw2RedC1RUHlMRHhFY3RoVHEtc2FhbXQ1aWc&usp=sharing
Slight improvements (~1%) to onload, render and DOM Content Loaded.
1-2% improvement on Speed Index.
BUG=408229
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=181842
Patch Set 1 : Moved async script priority to low #
Total comments: 6
Patch Set 2 : Fixed the usage of "const bool" #Patch Set 3 : Fixed member initialization order #Patch Set 4 : Switched to use DeferOption to track state #Patch Set 5 : Cleaned up a few stray member variables #Messages
Total messages: 12 (2 generated)
|