Skip to content

module: release consumed compile cache buffers - #9

Draft
maschwenk wants to merge 1 commit into
base-main-67e45e4afrom
compile-cache-release-consumed
Draft

maschwenk wants to merge 1 commit into
base-main-67e45e4afrom
compile-cache-release-consumed

Conversation

@maschwenk

Copy link
Copy Markdown
Owner

second upstream candidate, independent of the other one (also one commit on main 67e45e4)

once v8 accepts a cache read from disk node keeps the buffer until exit, only so it can hand it to v8 again if the same file gets compiled twice in one process. this frees it once v8 consumed it and just reads the file again in that case. caches the process made itself are kept until theyre written, the sea build needs that

warm cache, 30 paired runs vs main, timings unchanged:
• loading webpack + babel + prettier + eslint + typescript (431 cached files, 5.2 MB): max rss 137.4 → 135.4 MiB (−1.7%)
• eslint on a small project 111.9 → 109.6 MiB (−2.1%)
• tsc -p no change, its one 1.4 MB buffer doesnt show up in max rss

small win on its own, mostly worth it next to the after-execution change where it takes eslint's rss bump from +3.7% to +1.3%:

node's first-contribution guide says not to open a second PR before the first one is approved, so this one waits

Once V8 has accepted a cache read from disk, the compile cache keeps
the buffer until the process exits, only to pass it to V8 again if
the same code is compiled a second time in the process. Release it
once V8 has consumed it, and read the file again in that case, so a
process no longer holds the caches of all the modules it loaded in
memory. Caches produced by the process itself are kept until they
are written.
@maschwenk maschwenk added the coder-task-generated Opened by a coding agent label Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coder-task-generated Opened by a coding agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant