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

feat(next/image): reduce byte waste for 3x screens #20610

Merged
merged 4 commits into from
Dec 30, 2020

Conversation

Timer
Copy link
Member

@Timer Timer commented Dec 30, 2020

https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html

This means that most OLED screens that say they are 3x resolution, are actually 3x in the green color, but only 1.5x in the red and blue colors. Showing a 3x resolution image in the app vs a 2x resolution image will be visually the same, though the 3x image takes significantly more data. Even true 3x resolution screens are wasteful as the human eye cannot see that level of detail without something like a magnifying glass.

image

Even the iPhone doesn't have true 3x DPI!

related: #18756

@Timer Timer requested a review from styfle December 30, 2020 16:16
@vercel vercel bot temporarily deployed to Preview December 30, 2020 16:16 Inactive
styfle
styfle previously approved these changes Dec 30, 2020
Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find! 💯

We'll also need to update the test 👍

Also see Apple's Guidelines for more info about DPI.

@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 Timer/next.js feat/reduce-byte-waste Change
buildDuration 9.6s 9.9s ⚠️ +231ms
nodeModulesSize 83 MB 83 MB ⚠️ +1.28 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
/ failed reqs 0 0
/ total time (seconds) 1.919 1.987 ⚠️ +0.07
/ avg req/sec 1302.88 1258.2 ⚠️ -44.68
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.193 1.257 ⚠️ +0.06
/error-in-render avg req/sec 2096.31 1989.26 ⚠️ -107.05
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
677f882d2ed8..769b.js gzip 12.8 kB 12.8 kB
framework.HASH.js gzip 39 kB 39 kB
main-29e0222..8425.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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Rendered Page Sizes
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
index.html gzip 615 B 615 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
General Overall increase ⚠️
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
buildDuration 11.5s 11.6s ⚠️ +139ms
nodeModulesSize 83 MB 83 MB ⚠️ +1.28 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
677f882d2ed8..769b.js gzip 12.8 kB 12.8 kB
framework.HASH.js gzip 39 kB 39 kB
main-29e0222..8425.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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Serverless bundles
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.17 MB 5.17 MB
Commit: c895f8e

@ijjk

This comment has been minimized.

@vercel vercel bot temporarily deployed to Preview December 30, 2020 17:16 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 Timer/next.js feat/reduce-byte-waste Change
buildDuration 9.2s 9.5s ⚠️ +309ms
nodeModulesSize 83 MB 83 MB ⚠️ +1.28 kB
Page Load Tests Overall increase ✓
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
/ failed reqs 0 0
/ total time (seconds) 1.954 1.947 -0.01
/ avg req/sec 1279.27 1283.89 +4.62
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.238 1.202 -0.04
/error-in-render avg req/sec 2019.29 2079.81 +60.52
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Rendered Page Sizes
vercel/next.js canary Timer/next.js feat/reduce-byte-waste 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
General Overall increase ⚠️
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
buildDuration 11.1s 11.3s ⚠️ +210ms
nodeModulesSize 83 MB 83 MB ⚠️ +1.28 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Serverless bundles
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.17 MB 5.17 MB
Commit: 4a8f7aa

@ijjk

This comment has been minimized.

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

ijjk commented Dec 30, 2020

Stats from current PR

Default Server Mode
General Overall increase ⚠️
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
buildDuration 9s 8.7s -232ms
nodeModulesSize 83 MB 83 MB ⚠️ +1.28 kB
Page Load Tests Overall increase ✓
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
/ failed reqs 0 0
/ total time (seconds) 1.76 1.76
/ avg req/sec 1420.63 1420.54 ⚠️ -0.09
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.109 1.107 0
/error-in-render avg req/sec 2253.29 2257.42 +4.13
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Rendered Page Sizes
vercel/next.js canary Timer/next.js feat/reduce-byte-waste 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
General Overall increase ⚠️
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
buildDuration 10.6s 10.4s -246ms
nodeModulesSize 83 MB 83 MB ⚠️ +1.28 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste 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 Timer/next.js feat/reduce-byte-waste Change
_buildManifest.js gzip 320 B 320 B
Overall change 320 B 320 B
Serverless bundles
vercel/next.js canary Timer/next.js feat/reduce-byte-waste Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.17 MB 5.17 MB
Commit: 54a2700

@Timer Timer marked this pull request as ready for review December 30, 2020 18:13
@kodiakhq kodiakhq bot merged commit d1c5659 into vercel:canary Dec 30, 2020
@ijjk ijjk deleted the feat/reduce-byte-waste branch December 30, 2020 18:18
@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.

3 participants