mirror of https://github.com/sveltejs/svelte
fix: reduce SSR render result garbage collection (#18798)
Fixes #18797. ### Problem SSR `render()` is lazy, but the wrapper benchmark discarded its result and therefore measured almost no rendering work. When `.body` was consumed, each render result's own accessor properties caused substantial garbage-collection overhead. ### Fix - Consume `render(App).body` in both the warmup and measured SSR benchmark loops. - Move lazy render-result properties onto a shared `RenderResult` prototype. - Memoize synchronous output and the asynchronous render promise while preserving lazy sync/async API behavior. - Add a regression test ensuring exposed render-result properties are inherited. - Add a patch changeset for `svelte`. The benchmark now deliberately selects the synchronous lazy-render path by reading `.body`, so the process-wide async flag imported by the reactivity benchmarks does not determine this benchmark's render mode. ### Performance on this host | Case | Time | GC time | | --- | ---: | ---: | | main, output discarded | 0.20 ms | 0.00 ms | | main, `.body` consumed before fix | 163.04 ms | 62.68 ms | | `svelte@5.38.10` | 110.05 ms | 1.39 ms | | fixed, `.body` consumed | 104.79 ms | 2.43 ms | ### Tests - `pnpm test packages/svelte/src/internal/server/renderer.test.ts` — 53 passed - `pnpm test server-side-rendering` — 234 passed, 2 skipped - `pnpm test` — 7,771 passed, 55 skipped - `pnpm lint` - `pnpm check` - `pnpm format` - `git diff --check` <!-- svelte-triage-bot:feedback-baseline:116724e3b641c84ed56b2a60d494b6cb2298bbb3 --> Co-authored-by: svelte-triage-bot <team@svelte.com>pull/18759/merge
parent
6be176df2f
commit
a8a9b02e38
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: reduce SSR render result garbage collection
|
||||
Loading…
Reference in new issue