Skip to content

Shrink the Wasm inspection bindings by sorting borrowed records - #532

Merged
waywardmonkeys merged 1 commit into
mainfrom
perf/wasm-schema-size
Nov 26, 2026
Merged

waywardmonkeys merged 1 commit into
mainfrom
perf/wasm-schema-size

Conversation

@waywardmonkeys

Copy link
Copy Markdown
Contributor

Stage inspection can order the data it borrows before it allocates JavaScript wire records. The schema inventory previously copied names for sorting and carried the complete output rows through the sort. Reading load rules also interned owned copies of paths already present in the rule table.

Use the existing shared sorter for inspection records, including variant selections and collection membership rules. This removes specialized sorting routines from the downloaded module and preserves the exposed ordering.

Two release builds from the same base revision, with the workspace's wasm-bindgen and Binaryen versions, measured with Node 24.22.3:

Default browser module Before After Saved
Optimized bytes 3,462,158 3,444,631 17,527
Gzip bytes 1,349,505 1,343,610 5,895

Schema inventory sorting owned a second copy of each name and carried the encoded row through the sort. Load-rule inspection also cloned and interned each path just to compare and display it.

Sort borrowed paths, schema definitions, and field names before building the wire records. Route the remaining binding sorts through the workspace sorter so the browser module can reuse its ordering code across record types.
@waywardmonkeys
waywardmonkeys merged commit a80b9a8 into main Nov 26, 2026
18 checks passed
@waywardmonkeys
waywardmonkeys deleted the perf/wasm-schema-size branch November 26, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant