Bad side-by-side scrolling performance with syntax highlighting enabled
See original GitHub issueThe scrolling performance in a side-by-side window becomes really bad sometimes when highlighting is enabled. It’s not uncommon for the CPU to hit over 100%, which causes the scrolling to freeze. It doesn’t really seem related to the file size, it also happens for files of about 200 to 300 lines.
If I understand the Google Chrome profiler correctly, then most of the time is spend on the line Prism.highlightElement(preElement);
. This seems to be triggered by the scrolling event.
I haven’t looked into it any further, as I don’t really understand why the highlighter should run each time someone scrolls. But it would be great if this could be improved somehow.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Add syntax highlighting to diffs | Bitbucket Cloud
In side-by-side only the chunk that contains the visible portion is loaded. You can see this on large files when you quickly scroll...
Read more >Javascript syntax highlighting it not working
After I enabled the extension, syntax highlighting started working again. Go to Tools > Extensions and Updates > Installed. And look for "Visual...
Read more >Syntax - Neovim docs
Syntax highlighting enables Vim to show parts of the text in another font or color. Those parts can be specific keywords or text...
Read more >Slow Scrolling Syntax Highlighting : r/vim - Reddit
Every time I scroll through a file in gvim there is noticeable lag. When I disable syntax highlighting it seems to work fine....
Read more >kitty-diff - Kovid Goyal
A fast side-by-side diff tool with syntax highlighting and images Major Features: ... J , Down. Scroll page up. PgUp. Scroll page down....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Update after 1 week: I’ve not noticed any glitches or performance issues anymore. Thank you so much for this great update! 🎉
Hey @reyronald, thanks for the update.
I’ve done few quick tests and it’s looking better so far. With it enabled, looking at pretty much any side by side diff with syntax highlighting enabled would lock up Chrome, however I’ve tried a few diffs with the latest extension version and it’s remained mostly responsive. May be a couple of small stalls still, but nothing like the previous lockups I was seeing.
I’ll keep an eye on it throughout the week and see if I hit any diffs that still cause problems, but so far so good! Thanks very much!