Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move CSS Preloads to top of head at document render #18864

Merged
merged 5 commits into from
Dec 30, 2020

Conversation

atcastle
Copy link
Collaborator

@atcastle atcastle commented Nov 5, 2020

This should fix #18416, by moving all CSS preloads to the top of the head as the document is rendered. I think this is a reasonable optimization even outside of the context of the image component.

This also addresses a small issue with the image component where image preloads were getting removed from the DOM at hydration in some cases.

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@vercel vercel bot temporarily deployed to Preview December 30, 2020 17:23 Inactive
@vercel vercel bot temporarily deployed to Preview December 30, 2020 17:24 Inactive
@vercel vercel bot temporarily deployed to Preview December 30, 2020 17:24 Inactive
@ijjk
Copy link
Member

ijjk commented Dec 30, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary azukaru/next.js preload-css-first Change
buildDuration 10.2s 10.4s ⚠️ +141ms
nodeModulesSize 82.9 MB 83 MB ⚠️ +11.2 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary azukaru/next.js preload-css-first Change
/ failed reqs 0 0
/ total time (seconds) 2.117 2.11 -0.01
/ avg req/sec 1180.84 1184.79 +3.95
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.252 1.298 ⚠️ +0.05
/error-in-render avg req/sec 1996.03 1926.07 ⚠️ -69.96
Client Bundles (main, webpack, commons)
vercel/next.js canary azukaru/next.js preload-css-first Change
677f882d2ed8..769b.js gzip 12.8 kB 12.8 kB
framework.HASH.js gzip 39 kB 39 kB
main-a6ce971..96b9.js gzip 6.59 kB 6.59 kB
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59.1 kB 59.1 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary azukaru/next.js preload-css-first Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary azukaru/next.js preload-css-first Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-21c7af4..bddc.js gzip 1.6 kB 1.6 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.04 kB 8.04 kB
Client Build Manifests
vercel/next.js canary azukaru/next.js preload-css-first Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Rendered Page Sizes
vercel/next.js canary azukaru/next.js preload-css-first Change
index.html gzip 616 B 616 B
link.html gzip 622 B 622 B
withRouter.html gzip 609 B 609 B
Overall change 1.85 kB 1.85 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary azukaru/next.js preload-css-first Change
buildDuration 12.7s 12.3s -380ms
nodeModulesSize 83 MB 83 MB ⚠️ +1.23 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary azukaru/next.js preload-css-first Change
677f882d2ed8..769b.js gzip 12.8 kB 12.8 kB
framework.HASH.js gzip 39 kB 39 kB
main-a6ce971..96b9.js gzip 6.59 kB 6.59 kB
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59.1 kB 59.1 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary azukaru/next.js preload-css-first Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary azukaru/next.js preload-css-first Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-21c7af4..bddc.js gzip 1.6 kB 1.6 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.04 kB 8.04 kB
Client Build Manifests
vercel/next.js canary azukaru/next.js preload-css-first Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary azukaru/next.js preload-css-first Change
_error.js 1 MB 1 MB ⚠️ +369 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +369 B
link.js 1.06 MB 1.06 MB ⚠️ +369 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +369 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +369 B
Overall change 5.17 MB 5.17 MB ⚠️ +1.84 kB
Commit: f20b8bf

@Timer Timer added this to the iteration 15 milestone Dec 30, 2020
@vercel vercel bot temporarily deployed to Preview December 30, 2020 21:36 Inactive
@ijjk
Copy link
Member

ijjk commented Dec 30, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary azukaru/next.js preload-css-first Change
buildDuration 8.8s 8.8s ⚠️ +6ms
nodeModulesSize 83 MB 83 MB ⚠️ +1.23 kB
Page Load Tests Overall increase ✓
vercel/next.js canary azukaru/next.js preload-css-first Change
/ failed reqs 0 0
/ total time (seconds) 1.787 1.793 ⚠️ +0.01
/ avg req/sec 1398.88 1394.49 ⚠️ -4.39
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.132 1.107 -0.02
/error-in-render avg req/sec 2208.06 2258.72 +50.66
Client Bundles (main, webpack, commons)
vercel/next.js canary azukaru/next.js preload-css-first Change
677f882d2ed8..769b.js gzip 12.8 kB 12.8 kB
framework.HASH.js gzip 39 kB 39 kB
main-a6ce971..96b9.js gzip 6.59 kB 6.59 kB
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59.1 kB 59.1 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary azukaru/next.js preload-css-first Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary azukaru/next.js preload-css-first Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-1a1f628..eeb5.js gzip 1.61 kB 1.61 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.05 kB 8.05 kB
Client Build Manifests
vercel/next.js canary azukaru/next.js preload-css-first Change
_buildManifest.js gzip 322 B 322 B
Overall change 322 B 322 B
Rendered Page Sizes
vercel/next.js canary azukaru/next.js preload-css-first Change
index.html gzip 616 B 616 B
link.html gzip 621 B 621 B
withRouter.html gzip 609 B 609 B
Overall change 1.85 kB 1.85 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary azukaru/next.js preload-css-first Change
buildDuration 10.6s 10.7s ⚠️ +89ms
nodeModulesSize 83 MB 83 MB ⚠️ +1.23 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary azukaru/next.js preload-css-first Change
677f882d2ed8..769b.js gzip 12.8 kB 12.8 kB
framework.HASH.js gzip 39 kB 39 kB
main-a6ce971..96b9.js gzip 6.59 kB 6.59 kB
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59.1 kB 59.1 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary azukaru/next.js preload-css-first Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary azukaru/next.js preload-css-first Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-1a1f628..eeb5.js gzip 1.61 kB 1.61 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.05 kB 8.05 kB
Client Build Manifests
vercel/next.js canary azukaru/next.js preload-css-first Change
_buildManifest.js gzip 322 B 322 B
Overall change 322 B 322 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary azukaru/next.js preload-css-first Change
_error.js 1 MB 1 MB ⚠️ +369 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +369 B
link.js 1.06 MB 1.06 MB ⚠️ +369 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +369 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +369 B
Overall change 5.17 MB 5.17 MB ⚠️ +1.84 kB
Commit: 3789ffc

@Timer Timer merged commit 74909ec into vercel:canary Dec 30, 2020
@Timer Timer deleted the preload-css-first branch December 30, 2020 22:12
@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image component preload prioritizes image above CSS
3 participants