Commit 01622a8
committed
[Prefetch Inlining] Generate size-based hints on server
Part 1 of 2. This commit adds the server-side infrastructure for
size-based segment bundling but does not change any observable
behavior. The client-side changes that actually consume bundled
responses are in the next commit.
At build time, a measurement pass renders each segment's prefetch
response, measures its gzip size, and decides which segments should
be bundled together vs fetched separately. The decisions are
persisted to a manifest and embedded into the route tree prefetch
response so the client can act on them.
The decisions are computed once at build and remain fixed for the
lifetime of the deployment. They are not recomputed during
ISR/revalidation — if they could change, the client would need to
re-fetch the route tree after every revalidation, defeating the
purpose of caching it independently.
Refer to the next commit for a full description of the design and
motivation.
## Config
experimental.prefetchInlining accepts either a boolean or an object
with threshold overrides (maxSize, maxBundleSize). When true, the
default thresholds are used (2KB per-segment, 10KB total budget).
Eventually this will become the default; the flag exists only for
incremental rollout.1 parent d1fcd20 commit 01622a8
File tree
44 files changed
+1425
-39
lines changed- packages/next/src
- build
- templates
- client/components/router-reducer
- export/routes
- server
- app-render
- lib/incremental-cache
- test
- e2e/app-dir/segment-cache/prefetch-inlining
- production/app-dir/segment-cache-prefetch-hints
- app
- test-deep
- a
- b
- c
- test-dynamic/[slug]
- test-outlined
- test-parallel
- @sidebar
- test-restart
- large-middle
- after
- test-small-chain
- components
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
44 files changed
+1425
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
2739 | 2741 | | |
2740 | 2742 | | |
2741 | 2743 | | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
2742 | 2749 | | |
2743 | 2750 | | |
2744 | 2751 | | |
| |||
3194 | 3201 | | |
3195 | 3202 | | |
3196 | 3203 | | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
3197 | 3209 | | |
3198 | 3210 | | |
3199 | 3211 | | |
| |||
3369 | 3381 | | |
3370 | 3382 | | |
3371 | 3383 | | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
3372 | 3389 | | |
3373 | 3390 | | |
3374 | 3391 | | |
| |||
3958 | 3975 | | |
3959 | 3976 | | |
3960 | 3977 | | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
| 3983 | + | |
3961 | 3984 | | |
3962 | 3985 | | |
3963 | 3986 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
735 | 735 | | |
736 | 736 | | |
737 | 737 | | |
738 | | - | |
| 738 | + | |
| 739 | + | |
739 | 740 | | |
740 | 741 | | |
741 | 742 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
| 222 | + | |
221 | 223 | | |
222 | 224 | | |
223 | 225 | | |
| |||
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
| 236 | + | |
234 | 237 | | |
235 | 238 | | |
236 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
8 | 10 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
605 | 606 | | |
606 | 607 | | |
607 | 608 | | |
| 609 | + | |
608 | 610 | | |
609 | 611 | | |
610 | 612 | | |
| |||
1635 | 1637 | | |
1636 | 1638 | | |
1637 | 1639 | | |
| 1640 | + | |
1638 | 1641 | | |
1639 | 1642 | | |
| 1643 | + | |
1640 | 1644 | | |
1641 | 1645 | | |
1642 | 1646 | | |
| |||
1815 | 1819 | | |
1816 | 1820 | | |
1817 | 1821 | | |
| 1822 | + | |
1818 | 1823 | | |
1819 | 1824 | | |
| 1825 | + | |
1820 | 1826 | | |
1821 | 1827 | | |
1822 | 1828 | | |
| |||
5534 | 5540 | | |
5535 | 5541 | | |
5536 | 5542 | | |
5537 | | - | |
| 5543 | + | |
5538 | 5544 | | |
5539 | 5545 | | |
5540 | 5546 | | |
5541 | | - | |
| 5547 | + | |
| 5548 | + | |
| 5549 | + | |
5542 | 5550 | | |
5543 | 5551 | | |
5544 | 5552 | | |
| |||
5788 | 5796 | | |
5789 | 5797 | | |
5790 | 5798 | | |
5791 | | - | |
| 5799 | + | |
5792 | 5800 | | |
5793 | 5801 | | |
5794 | 5802 | | |
5795 | | - | |
| 5803 | + | |
| 5804 | + | |
| 5805 | + | |
5796 | 5806 | | |
5797 | 5807 | | |
5798 | 5808 | | |
| |||
5997 | 6007 | | |
5998 | 6008 | | |
5999 | 6009 | | |
6000 | | - | |
| 6010 | + | |
6001 | 6011 | | |
6002 | 6012 | | |
6003 | 6013 | | |
6004 | | - | |
| 6014 | + | |
| 6015 | + | |
| 6016 | + | |
6005 | 6017 | | |
6006 | 6018 | | |
6007 | 6019 | | |
| |||
6165 | 6177 | | |
6166 | 6178 | | |
6167 | 6179 | | |
6168 | | - | |
| 6180 | + | |
6169 | 6181 | | |
6170 | 6182 | | |
6171 | 6183 | | |
6172 | | - | |
| 6184 | + | |
| 6185 | + | |
| 6186 | + | |
6173 | 6187 | | |
6174 | 6188 | | |
6175 | 6189 | | |
| |||
6289 | 6303 | | |
6290 | 6304 | | |
6291 | 6305 | | |
6292 | | - | |
6293 | | - | |
| 6306 | + | |
| 6307 | + | |
| 6308 | + | |
| 6309 | + | |
6294 | 6310 | | |
6295 | 6311 | | |
6296 | 6312 | | |
| |||
6321 | 6337 | | |
6322 | 6338 | | |
6323 | 6339 | | |
6324 | | - | |
| 6340 | + | |
| 6341 | + | |
| 6342 | + | |
| 6343 | + | |
| 6344 | + | |
| 6345 | + | |
| 6346 | + | |
| 6347 | + | |
| 6348 | + | |
| 6349 | + | |
| 6350 | + | |
| 6351 | + | |
| 6352 | + | |
| 6353 | + | |
| 6354 | + | |
| 6355 | + | |
| 6356 | + | |
| 6357 | + | |
| 6358 | + | |
| 6359 | + | |
| 6360 | + | |
| 6361 | + | |
| 6362 | + | |
| 6363 | + | |
| 6364 | + | |
| 6365 | + | |
| 6366 | + | |
| 6367 | + | |
| 6368 | + | |
| 6369 | + | |
| 6370 | + | |
| 6371 | + | |
| 6372 | + | |
| 6373 | + | |
| 6374 | + | |
| 6375 | + | |
| 6376 | + | |
| 6377 | + | |
6325 | 6378 | | |
6326 | 6379 | | |
6327 | 6380 | | |
6328 | 6381 | | |
6329 | 6382 | | |
6330 | | - | |
| 6383 | + | |
| 6384 | + | |
6331 | 6385 | | |
6332 | 6386 | | |
6333 | 6387 | | |
| |||
0 commit comments