Skip to content

compiler: implement pos-only mode for implicit spaces - #602

Merged
pdubroy merged 9 commits into
mainfrom
pdubroy/spaces-skip-cst
Mar 24, 2026
Merged

compiler: implement pos-only mode for implicit spaces#602
pdubroy merged 9 commits into
mainfrom
pdubroy/spaces-skip-cst

Conversation

@pdubroy

@pdubroy pdubroy commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Implement a "pos-only" mode for implicit space skipping. In pos-only mode, we don't build a CST, do failure recording, etc. This results in a significant performance improvement, and a huge memory savings.

Before

$ bin/es5bench-wasm
Compile: 66ms
......
JS match: 3312.9ms ± 284.9ms (n=3)
Wasm match: 79.1ms ± 26.7ms (n=3)
Wasm vs JS match: 41.9x
Wasm memory: 174.0MB

After

$ bin/es5bench-wasm
Compile: 57ms
......
JS match: 3311.9ms ± 113.2ms (n=3)
Wasm match: 55.8ms ± 15.7ms (n=3)
Wasm vs JS match: 59.3x
Wasm memory: 87.0MB

@pkg-pr-new

pkg-pr-new Bot commented Mar 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/ohmjs/ohm/@ohm-js/compiler@602
npm i https://pkg.pr.new/ohmjs/ohm/ohm-js@602
npm i https://pkg.pr.new/ohmjs/ohm/@ohm-js/to-ast-compat@602

commit: 34ee81e

@pdubroy
pdubroy merged commit 670fb6b into main Mar 24, 2026
5 checks passed
@pdubroy
pdubroy deleted the pdubroy/spaces-skip-cst branch March 24, 2026 11:16
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