Description
This is a sibling of #410
During the cleanup PR #424, we replaced the ListBox with ListView. This was suggested a while ago to solve some of the performance issues #179.
How it was implemented
ListView items can either be generated and bound using UI files or with signal factories. Since many parts of the status widgets are dynamically constructed, I went with signal factories.
There are 4 stages and signals: setup -> bind -> unbind -> teardown
The docs explain them in detail https://valadoc.org/gtk4/Gtk.SignalListItemFactory.html.
This might be where I screwed up, by creating the widget on bind rather than going through the process of setting it up, binding it and unbinding it when needed. However after some more testing and actually implementing it properly, I noticed the exact same issues listed below.
The pros
- Improved the overall performance of the app, like animations, resizing etc
- Made scrolling to a certain post easy
- Got rid of the entity_queue as the scroll position wont change when new items get prepended
The cons
- Main loop blocking when creating status widgets #410 is still very much an issue. When you load a new page / batch it still blocks the main loop. I've been unable to pinpoint it down to anything with Sysprof and other debugging tools. My only speculation is that the widget is too complex and makes use of both dynamically constructing widgets and UI files
- The performance is terrible once it hits the ListView threshold of 200(?) objects. At the point every single scroll change causes many destructions and constructions of widgets
- Status widgets are used a lot as a base for other widgets and since we no longer have access to the widgets directly, we need to abuse the entities (that are cached). For example, thread threadlines need to be in the API.Statuses now
- For unknown reasons, listview items are no longer keyboard navigatable?