JavaScript Loading Priorities in Chrome
February 18, 2019
How browsers schedule and execute scripts can impact the performance of web pages. While techniques like <script defer>, <link rel=preload> (and others) influence script loading, knowing how browsers interpret them can also be helpful. Thanks to Kouhei Ueno, we now have an up to date summary of script scheduling in Chrome.
| Loading priority (network/Blink) |
Execution priority | Where should this be used? | |||||||||||||||||||||||||
<script> in <head>
|
Medium/High | VeryHigh - Blocks parser |
<link rel=preload> +<script async> hack
or
Medium/High
|
High - |
Interrupts parser |
This above priorities [summary](/../assets/images/tweet-priorities@3x.png) is still true as of February 2019. I would personally love to get a better understanding of loading priorities in other browsers too. Hopefully this overview is useful to someone out there!
_Thanks to Kouhei, Dom Faralino, Pat Meenan, Kenji Baheux and Yoav Weiss for their contributions helping better explain Chrome's network stack._
## Further reading
- [Scheduling Scripts Intuitively and Performantly](https://bit.ly/script-scheduling)
- [Chrome Resource Priorities and Scheduling](https://docs.google.com/document/d/1bCDuq9H1ih9iNjgzyAL0gpwNFiEP4TZS-YLRp_RuMlc/edit#)
- [Preload, Prefetch And Priorities in Chrome](https://medium.com/reloading/preload-prefetch-and-priorities-in-chrome-776165961bbf)
- [Priorities for rel=preload in Chrome and WebKit](https://twitter.com/yoavweiss/status/1096075414697639936)