-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
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:
- Provide CLI flag to turn off the syntax highlighter (right now it seems to be tied to the theme setting).
- Use a more performant syntax highlighter implementation. Anecdotally, WASM is much slower than the native, and the call between JS and WASM is also extremely expensive. This worsens when you only call the highlighter one line at a time.
For comparison, https://github.com/dandavison/delta uses https://github.com/trishume/syntect and is very fast.
webbertakken
Metadata
Metadata
Assignees
Labels
No labels

