Skip to content

fix: keep memory flat when precompressing many files - #16993

Merged
teemingc merged 3 commits into
version-3from
compress-once
Sep 18, 2026
Merged

teemingc merged 3 commits into
version-3from
compress-once

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Sep 1, 2026 •

Copy link
Copy Markdown
Member

builder.compress starts gzip and brotli streams for every file at once. Node runs zlib work on its threadpool (https://nodejs.org/api/zlib.html#threadpool-usage-and-performance-considerations), so the fan-out only costs memory.

This reads each file once and compresses 16 at a time. On 2000 files x 20 KB that is 2.5 s and +800 MB before, 1.8 s and +14 MB after.

The brotli params are dropped because at the default quality of 11 the encoder ignores them. Output is byte-identical.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 6a992b2:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/6a992b2f24123592ab81e3c77d5ee56bc4017db3

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16993

@changeset-bot

changeset-bot Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6a992b2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: fa2a6edc-521a-4baf-91bd-74dd1c9da456

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@svelte-docs-bot

Copy link
Copy Markdown

@Nic-Polumeyv
Nic-Polumeyv removed this pull request from stack #16909 September 15, 2026 00:09
@Nic-Polumeyv
Nic-Polumeyv changed the base branch from manifest-static-assets to adapter-node-drop-prebuild September 15, 2026 00:09
@Nic-Polumeyv
Nic-Polumeyv removed this pull request from stack #17110 September 17, 2026 19:30
@Nic-Polumeyv
Nic-Polumeyv changed the base branch from adapter-node-drop-prebuild to version-3 September 17, 2026 19:30

@Rich-Harris Rich-Harris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the Array.from({ length: 16 }, ...) trick is super clever. took me a minute

@teemingc
teemingc merged commit 5d8722c into version-3 Sep 18, 2026
40 checks passed
@teemingc
teemingc deleted the compress-once branch September 18, 2026 20:39
dadezzz added a commit to dadezzz/events-cash-register that referenced this pull request Oct 5, 2026