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
vBox unusably slow if you give it hundreds of items #264
Comments
Greetings, and thanks for your report! The behavior you are experiencing is definitely unpleasant, but is expected. The problem isn't To get better performance, there are two main options:
Let me know if either of those options help. I'm happy to provide more details or point you at resources. |
Thank you for your reply. Sorry I hadn't read that pitfall. I am not sure the caching would help the arrow/link selection changes the widgets; when I cache it does not visibly move anymore. I imagine there are no gains to be had if the big lag comes from moving the link selection/manipulating the widgets to move the arrow/active link style and I just invalidate the cache every time I move the link as aforementioned. Here is an early example of desired behavior as I had it: https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/fosstodon/media_attachments/files/003/984/420/original/013774236259d7f4.mp4 Here's another example from more recent: https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/fosstodon/media_attachments/files/003/996/873/original/d1c39724ffad67c9.mp4 It sounds like the only option for me is to try some trickery with only rendering as much contents as between the current and next link, roughly. I also was never able to figure out getting the available height. |
No problem - I mentioned that not to say that it should have been obvious, but just to say that I had tried. But I could probably do better putting a big red warning sign on this kind of situation. It has come up before, at least a few times.
That's right; the caching approach only works for content that stays the same while you scroll it. If you want a cursor, you need a
That's right. The caching will only help if it allows you to avoid re-rendering all of the contents every time, especially the off-screen contents.
Oh! For that, see this section of the User Guide. The key is to get the rendering context and look at the |
Okay, I think I saw something on how you can avoid using lens by basically dropping the L... I'm new to Haskell, so forgive me if I take a while to test this out and respond. I will attempt to only render the lines of the gopher resource that are being shown in the viewport or something of the sort. |
No problem. And yes, the convention I used in |
Thanks, I'll try using the list for this purpose. I will keep posting in this thread to keep others who experienced this caveat (namely I'll link to a commit later), but will close it for now since vbox is expected to have this behavior. Here is what I've come up with (this is worth reading, for those wondering; basically the ListVi application example was exactly what I wanted): https://fosstodon.org/@coffeerobot/103742873209495658 It still needs some work but this effectively solves my problems. Thank you so much for your work developing a remarkable library @jtdaugherty and for having the patience and thoroughness when addressing my concerns so quickly. Also thanks to @Garmelon (who has been helping me to understand Haskell and Brick, specifically). |
You're welcome, and I'm glad I was able to help! |
`viewport` is unreasonably inefficient for our usecase when the IOTree grows, as it decides what to display once it rendered to full `IOTree`. Especially while scrolling, this inefficiency became apparent. Unfortunately, brick doesn't have any builtin way to improve this, see jtdaugherty/brick#264 We take `drawListElement` as an inspiration, and only render up to `heightOfBox * 2` elements of the `IOTree`, including expanded tree nodes. This speeds up the view noticeably, giving the user a responsive experience. In particular, we decouple rendering metadata computation from the actual rendering to decide which rows to render.
I am writing this: https://github.com/hyperreal-gopher/hopher and I profiled it and found out
vBox
is choking on gopher pages with hundreds of lines (gopher is very line-oriented, so I have made each line a widget, especially so I can move the selector around while also being able to scroll text in the viewport independent of the selection...).It's basically unusuable and at this point I'm considering using the List widget but I'm not so sure that will be ideal for exactly what I want, either.
The text was updated successfully, but these errors were encountered: