Optimize TypeScript SDK VM memory - #743
Draft
w0nche0l wants to merge 3 commits into
Draft
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
w0nche0l
marked this pull request as draft
August 3, 2026 19:42
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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
Twenty-run attribution
Median retained import heap:
OpenRouterCore: 965,552 bytesresponsesSend: 41,988,580 bytesA text-delta-specific schema is ~95% lighter than the all-event union. Lazy event dispatch alone only shifts the peak because completion eventually loads an 18 MB graph. A material reduction needs generator-owned operation-private, discriminator-aware validators.
Rejected prototypes
useIndexModules: false: pinned generation creates naming/type collisions and would require unsafe aliases/public renames.Safe retained optimization
The codec split reduces the transport bundle 118,279 → 118,098 raw bytes and median retained transport import heap 973,592 → 965,016 bytes.
Verification
OPENROUTER_TEST_KEYLinear: https://linear.app/openrouter/issue/ECO-2751
Parent: https://linear.app/openrouter/issue/ECO-2747