-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax highlighting is SLOW #15
Comments
Hey linjie! Yeah I went down the same path in shikijs/shiki#151, which should speed it up a little (~30% for me). Also see https://github.com/banga/git-split-diffs#performance.
You can override the theme setting to disable it, see https://github.com/banga/git-split-diffs#syntax-highlighting
I didn't do a lot of research into this, but |
As I mentioned here that the call into WASM can be pretty expensive if each of them is only doing a little work. Have you experimented with batching more content for the highlighter? |
Ohh got it. I haven’t, will look into it. It’s a little tricky because buffering will delay the initial render which is when the delay is most noticeable, but it’s probably not that much compared to the wasm overhead |
This tool is pretty slow when I tried piping a large diff to it, taking nearly 4 seconds. So I profiled it with
perf
and found that a lot of time is spent in the WASM library (https://github.com/NeekSandhu/onigasm) indirectly used by https://github.com/shikijs/shiki/.If I comment out the usage of
highlightSyntaxInLine
, then it takes less than 500ms to display the previous diff. This is the perf report:Have you considered:
For comparison, https://github.com/dandavison/delta uses https://github.com/trishume/syntect and is very fast.
The text was updated successfully, but these errors were encountered: