Commit 9bcb7aa
perf: skip unnecessary reactive setup during SSR
Three targeted optimizations to reduce per-request overhead during
server-side rendering:
1. loadable.shared-runtime.tsx: Skip setTimeout timer setup during SSR.
The LoadableSubscription creates delay/timeout timers that only serve
to update UI state for loading indicators. During SSR, React renders
once synchronously — there are no subscribers to notify and the timers
would leak in the Node.js process. The synchronous `delay === 0` path
is preserved since it has no side effects.
2. request-meta.ts: Use undefined assignment instead of delete when
removing request metadata keys. The `delete` operator causes V8 to
create a new hidden class (shape transition), which de-optimises
inline caches on downstream property accesses. Setting to undefined
is semantically equivalent since consumers check via meta[key].
3. base-server.ts: Replace a delete-loop over query keys with fresh
object creation, and use undefined assignment instead of delete for
the Next-URL header. Both avoid V8 hidden class mutations.
Inspired by: https://tanstack.com/blog/tanstack-start-5x-faster-ssr
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 196ed2b commit 9bcb7aa
3 files changed
+16
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1541 | 1541 | | |
1542 | 1542 | | |
1543 | 1543 | | |
1544 | | - | |
1545 | | - | |
1546 | | - | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
1547 | 1547 | | |
1548 | | - | |
1549 | | - | |
1550 | | - | |
1551 | | - | |
| 1548 | + | |
1552 | 1549 | | |
1553 | 1550 | | |
1554 | 1551 | | |
| |||
2018 | 2015 | | |
2019 | 2016 | | |
2020 | 2017 | | |
2021 | | - | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
2022 | 2021 | | |
2023 | 2022 | | |
2024 | 2023 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
376 | 379 | | |
377 | 380 | | |
378 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
200 | 203 | | |
201 | 204 | | |
202 | 205 | | |
| |||
205 | 208 | | |
206 | 209 | | |
207 | 210 | | |
208 | | - | |
| 211 | + | |
209 | 212 | | |
210 | 213 | | |
211 | 214 | | |
| |||
0 commit comments