WASM + typescript-go#1677
Open
SamuelMarks wants to merge 2 commits intodsherret:latestfrom
Open
Conversation
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.
This doesn't need to be merged, more it's just to start a new conversation à la #1656
FWIW: I got my cdd-ts.wasm—Compiler Driven Development (CDD) being a suite of open-source compilers, each written in the language they target, for going to/fro OpenAPI [and more!]—down from 138MB to 106MB. Just by switching from typescript to typescript-go.
Description
This PR fundamentally shifts the compiler architecture of
ts-morphby replacing the JavaScripttypescriptpackage with Microsoft'stypescript-goport compiled to WebAssembly (Wasm).As detailed in
rfcs/RFC-0002-Go-Wasm-Compiler-Migration.md, this brings massive performance improvements (up to 60% faster cold parsing) and slashes the V8 memory overhead by keeping AST structures inside the Wasm linear memory.Key Changes
go buildandwasm-opt(Binaryen) inscripts/build-wasm.ts.FinalizationRegistryto synchronize Go's garbage collector with V8.Project.create()to accommodate asynchronous Wasm compilation.WasmNode,WasmType, andWasmSymbolproxies that lazily query the Wasm runtime usingsyscall/js.npm run test:wasm) and added E2E real-world benchmarks.Notes for Reviewers
packages/compiler-go-source).npm installanddeno task setupto build the new Wasm dependencies locally.