Skip to content

Adopt vscode-oniguruma#95958

Merged
alexdima merged 2 commits intomasterfrom
alex/vscode-oniguruma-wasm
Apr 23, 2020
Merged

Adopt vscode-oniguruma#95958
alexdima merged 2 commits intomasterfrom
alex/vscode-oniguruma-wasm

Conversation

@alexdima
Copy link
Copy Markdown
Member

@alexdima alexdima commented Apr 23, 2020

All measurements done with the setting:

"editor.maxTokenizationLineLength": 200000000

VS Code Desktop

File Size Lines Before After Difference
checker.ts 2.2MB 38127 15990 5551 2.9x faster
sqlite3.c 7.7MB 228634 23241 12189 1.9x faster
bootstrap.min.css 152.1KB 7 1653 6900 4.1x slower
cpp.tmLanguage.json 477KB 16221 416 139 3x faster

image

VS Code Web (Chrome Version 81.0.4044.122)

File Size Lines Before After Difference
checker.ts 2.2MB 38127 21255 5573 3.8x faster
sqlite3.c 7.7MB 228634 35981 11196 3.2x faster
bootstrap.min.css 152.1KB 7 -- 5100 --
cpp.tmLanguage.json 477KB 16221 261 136 1.9x faster

image

@alexdima alexdima self-assigned this Apr 23, 2020
@alexdima alexdima added this to the April 2020 milestone Apr 23, 2020
@alexdima alexdima merged commit 41b936b into master Apr 23, 2020
@alexdima alexdima deleted the alex/vscode-oniguruma-wasm branch April 23, 2020 12:03
@alexdima alexdima changed the title Adopt vscode-oniguruma-wasm Adopt vscode-oniguruma May 4, 2020
@emidoots
Copy link
Copy Markdown

emidoots commented May 7, 2020

@alexdima are these before/after measurements in milliseconds or something else?

Do you happen to have millisecond measurements, or info on how you measured? Curious how this approach compares to https://github.com/trishume/syntect :)

@emidoots
Copy link
Copy Markdown

emidoots commented May 7, 2020

Also curious if you have any ideas why bootstrap.min.css became 4.1x slower on VS Code Desktop?

@nojvek
Copy link
Copy Markdown
Contributor

nojvek commented May 7, 2020

Came here from link in release notes.

I have massive respect for you @alexdima + vscode team's ever prioritization of performance. Really cool that this uses webassembly under the hood. Wow!

@mt-webdev
Copy link
Copy Markdown

This is insane! Keep it up!!

@alexdima
Copy link
Copy Markdown
Member Author

@slimsag Yes, the measurements are in millis. I got them by running F1 > Developer: Force Retokenize which flushes any cached tokens and synchronously (without yielding) tokenizes the entire file top-bottom. It then prints the time taken to the developer tools... [Normally tokenization runs for some time, then yields to allow the event loop to process events, then tokenizes again, etc].

https://github.com/trishume/syntect looks like a great project. I'm not sure how times can be compared objectively. The current JS TM grammar that VS Code ships with is not written with speed in mind (it is basically the entire TS TM grammar with some minor things removed). Philosophically, it is also written more like a parser, which leads sometimes to some extraordinarily complex regular expressions -- e.g.). Matching such regular expressions is no breeze for any regex engine:

image

Regarding bootstrap.min.css, I honestly didn't have a lot of time to dig deep into it, since I was so happy with the wins for the regular files. Minified code is something very specific to the web ecosystem (CSS/JS/HTML), and VS Code often cheats by ignoring such long lines. There is a setting to forcefully enable parsing of those, but that is used rarely in practice, since most folks end up opening a minified file due to a breakpoint or to check something out, and rarely have the intention of really editing the minified code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants