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
PoC: flexible height of list items #11719
Comments
I suppose that on faster devices (or in other words, not ereaders) the performance impact might be acceptable but yeah, that's a lot. |
I really like the looks of it, FWIW. Bummer that the performance difference is that stark. |
So it is faster to render the whole book than to make that bookmark list, that's something. I already think "full search" takes a bit too long when you look up a popular word, with this it would take forever, but it looks so much nicer. |
As usual, we can speed up by sacrificing the precision. To build the felxible height list we need to know the height of each item. I tried to calculate the estimated height for given available width: I took a width of "M" as char_width. It is a wide letter, so we need less lines for actual text (with narrow letters). But we do not use full available width in each line (unjustified), so we need more lines. Some kind of a balance. It is really fast, no delay in building the long bookmark list. One bad case is that we could give an item less height than it requires, and it will be truncated. For example, the max number of lines is set to 4, estimated calculation produces 3, we draw the item in 3 lines and it is truncated - it could be drawn in 4 lines without truncation. |
Dunno how you estimate the total_number_of_chars - but if you just use the string length, in languages with lots of diacritics or complex shaping (some hebrew, indic), the actual nb of "glyphs" (chars taking the ~ room of |
|
Building 260 bookmarks measurement (sec): Half a second is acceptable I think. |
This is already the case (with current implementation), so not a big deal.
Seems like a sacrifice I am willing to make it. |
May be useful for bookmark list, or fulltext search results list.
In the example the height is limited by 4 lines.
But the main problem is the speed.
The above list of 260 bookmarks is built for less than 2 sec without flexible height, and for about 7 sec with it.
It is too long and I see no way to speed up: without flexible height we build TextBoxWidget items for one page only, and for flexible height we must build all TextBoxWidget items before displaying.
The text was updated successfully, but these errors were encountered: