Content:Performancedocument not writtenhelp wanted
仓库指标
- Star
- (8,900 star)
- PR 合并指标
- (平均合并 7天 3小时) (30 天内合并 147 个 PR)
描述
When loading a page with many resources it can be useful to prioritize the requests so that the page appears to render more quickly. It would be useful to have a topic on this.
There are a bunch of ways to do this:
- Use
fetch()and set the priority inRequest.priority. - Set the HTTP priority on
HTMLLinkElement,HTMLIFrameElement, andHTMLImageElementelements (and associated tags) using thefetchpriorityattribute. - In future maybe Priority HTTP header. There are also some ideas (from here), some of which may be relevant (e.g. marking the non-critical ones as
async): - Mark non-critical scripts as async
- Consider inlining @font-face declarations directly into HTML
- Avoid using CSS background images or @import
- Use preload to retrieve critical resources earlier
Possible locations for such a page are under these:
- https://developer.mozilla.org/en-US/docs/Web/Performance
- https://developer.mozilla.org/en-US/docs/Web/API/fetch ?
This comes out of the discussion here: https://github.com/mdn/content/issues/14561