feat(v18): overridable wasm memory flags + pg18-lowmem-* publish flow - #165
Merged
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Review complete. No blocking issues — approved ✅; 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
This PR introduces optional low-memory wasm build variants by threading new override variables through the build tooling and documenting the release flow.
One low-severity, comment-only issue found: the inline example omits the Reviewed commit: f164120 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Motivated by the Supabase team's report: each live wasm parser instance reserves the build-time
INITIAL_MEMORYfloor (128MiB since the Aug 2025 large-SQL fix), which is heavy for parse-only worker pools. This makes the floor tunable for v18 builds only — no other version and no template is touched, and default artifacts are byte-identical.versions/18/Makefileparameterizes the emscripten memory flags:so a variant builds with
pnpm wasm:make build WASM_INITIAL_MEMORY=33554432 WASM_STACK_SIZE=8388608. (INITIAL_MEMORYmust exceedSTACK_SIZE+ ~2.5MiB static data, so the 16/32MiB floors also lower the stack.)PUBLISH.mdgains a "Low-Memory Variants" section: exact per-variant steps that publishversions/18aslibpg-query@18.1.5-lowmem-<floor>.<n>under dist-tagspg18-lowmem-16|32|64(prerelease versions +TAG=... pnpm run publish:pkg, which publish-single-version.js already supports via theTAGenv), keepinglatest/pg18untouched.Note: versions/18/Makefile is marked "generated from templates" —
copy:templateswould overwrite this change (like the existing hand-edited repo URLs, per REPO_NOTES.md).Verified locally: built 16/32/64MiB v18 variants;
HEAPU8.lengthafter init scales as configured (16/32/64/128MiB); all pass the 90-test suite, parse 20k unique statements with the same RSS plateau as the default build, handle a 2.2MB single statement (growth kicks in), and the 4MiB stack still parses expressions nested 5000 deep.Link to Devin session: https://app.devin.ai/sessions/8f91a064d1334f74926c73a62df82de5
Requested by: @pyramation