Closed AnirudhG07 closed 1 month ago
Ok one thing I noticed, this is not just for notebooks. Any plugin based preview, the same issue will occur. Like if I display codes with bat
the scrolling becomes SLOW. miller.yazi
, glow.yazi
, all are much slower.
First off, it's definitely not that the plugin itself is slow. All of Yazi's previewers are implemented through plugins (see them at https://github.com/sxyazi/yazi/tree/main/yazi-plugin/preset/plugins), and they run concurrently, plus, Lua is a very simple and fast language, so there's no reason for it to be slow.
On the other hand, the reason the built-in syntax highlighting is fast is that it calls Yazi's internal functions rather than external commands, which avoids the whole process creation lifecycle. Additionally, it's heavily optimized and is much faster than bat
- bat
renders the entire file instead of just the visible area. That's also why I chose to implement it myself, as I explained in https://github.com/sxyazi/yazi/issues/143.
To sum up, the speed of external previewers completely depends on how fast the external command is created and executed. This isn't something Yazi can fix. When it comes to process creation, you might need to tweak some OS-related settings. For execution, you'll need to find faster commands or implement a faster previewer yourself. I don't think these two aspects are issues Yazi can solve, because they're not really problems with Yazi itself.
I understand. Thanks for the clarification. I was hoping to use bat, for the line numbers, having wrapping with line numbers would be a bit more comfortable.
I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
What system are you running Yazi on?
macOS
What terminal are you running Yazi in?
item
yazi --debug
outputDid you try the latest nightly build to see if the problem got fixed?
Yes, and I updated the debug information above (
yazi --debug
) to the nightly that I triedDescribe the bug
The regular code scrolling is fast. I like it. But when it comes to scrolling Jupyter notebooks, it is really slow WHEN I use plugins like
rich-preview
ornbpreview
. I know this is not an inbuilt feature for providing formatted and good looks for ipynb files. But it would be nice if there was a way we could increase the scrolling speed for these. Do you have any ideas for it?Minimal reproducer
1) Download either of those plugins with
ya pack -a AnirudG07/nbpreview
orAnirudhG07/rich-preview
2) make a long Jupyter nb, and preview it.You will see nbpreview takes more time to load compared to rich-preview. But after loaded, then slowness of scrolling is really bad. It practically makes viewing the notebooks useless. On the other hand, these provides inbuilt wrapping so we dont have to worry about that part.
Anything else?
No response