This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#11168 - Default font for cabbie loads incredibly slowly
Attached to Project:
Rockbox
Opened by Torne Wuff (torne) - Friday, 02 April 2010, 18:01 GMT+2
Last edited by Torne Wuff (torne) - Sunday, 05 June 2011, 12:54 GMT+2
Opened by Torne Wuff (torne) - Friday, 02 April 2010, 18:01 GMT+2
Last edited by Torne Wuff (torne) - Sunday, 05 June 2011, 12:54 GMT+2
|
DetailsThe version of cabbiev2 for players with 320x240 or 240x320 screens (ipod video, gigabeat, etc) uses 15-Adobe-Helvetica as the font. This font is much larger than all the other versions of Helvetica we ship, presumably because it covers more of Unicode. The result is that the font is over 60000 bytes, which is the limit for the "fast" font loading method where the font is loaded all at once, and the font gets loaded in tiny pieces according to the glyph cache.
On most players this seems to be 4-5 times slower, taking 250ms or longer to execute font_load compared to 70ms for a font which fits in the buffer. This is bad enough; however, on ipodvideo 5.5G, with the 1024-byte sectors, loading 15-Adobe-Helvetica takes 6 seconds - 30 times slower than loading a small font. The sector emulation is making the piecemeal loading a *far* worse case. Useful though it is to have the default theme use a font with reasonably good unicode coverage, I think these kinds of load times are just hopeless and provide a bad experience for users who haven't chosen their own theme. The choice of font for cabbie on *other* screen sizes is a much smaller file, also, which suggests that this wasn't a conscious decision to use a font with high coverage, it just happened by coincidence. I recommend that we either strip glyphs from 15-Adobe-Helvetica until it fits in the buffer, or change Cabbie to use a different font instead. Fixing the font caching to not be so slow would be nice, but a lot more work ;) |
This task depends upon
Closed by Torne Wuff (torne)
Sunday, 05 June 2011, 12:54 GMT+2
Reason for closing: Works For Me
Additional comments about closing: We can't reproduce this.
Sunday, 05 June 2011, 12:54 GMT+2
Reason for closing: Works For Me
Additional comments about closing: We can't reproduce this.
I strongly object the rational of limiting Unicode coverage of a default font. I would say the opposite - increase coverage as much as possible so that new users will find that Rockbox just works for them. Increasing Unicode coverage increases the users base - adding support for Chinese language makes Rockbox an appealing product for all Chinese users, etc.
I think users expect Rockbox to work out-of-the-box, and that includes the ability to display their music tracks ID3 info properly (provided it is encoded as UTF-8, otherwise they will have to change default codepage).
I think we shouldn't expect users to know that they can resolve the issue of having text displayed as gibberish by changing the theme's font. They just think that Rockbox doesn't support their language and that it sucks (pardon me for that).
If I have to choose a temporary solution for this issue I would choose longer boot time over narrower Unicode coverage.
I think we should rather have users that might think Rockbox boots a bit slower than they expect it to, but is a great software that works as they expect it to work, than to have users who experience a super-fast loading unusable piece of s...oftware.
> Fixing the font caching to not be so slow would be nice, but a lot more work ;)
I think we should go towards fixing font caching. I suggest loading only a minimal set of glyphs upon boot, e.g. loading only English, and leaving other glyphs to be loaded upon first use. We don't have to fill the cache at boot time, we can have it grow over time.
I don't agree with the rationale of "we should punish users with 5 seconds of extra boot time to prevent some users from having to change the theme." The cost of wider unicode support is a decision that should be left up to the user, and it's more likely they'll know that decision exists if they see something that doesn't work at all (characters missing) that leads them to check the manual, than if they just have a slow boot and think "Oh, Rockbox takes a while to start I guess."
I disagree here. Unicode coverage vs. use is always a trade off. For me, I don't need asian characters and the like, and I prefer faster loading than loading glyps that I never need. I also prefer having a smaller font buffer if the space is simply not needed. As far as I can see the current font buffer size is a good tradeoff for a lot of cases. It might not be for targets with larger screen size (like Beast and 5G). So this raises the (somewhat) important question: which glyphs are actually used by most users?
> and that includes the ability to display their music tracks ID3 info properly (provided it is encoded as UTF-8, otherwise they will have to change default codepage).
(unrelated side note: there are tag types around that don't require setting a code page. Vorbis comments for example are always utf-8).
> If I have to choose a temporary solution for this issue I would choose longer boot time over narrower Unicode coverage.
I completely disagree here. Increasing the font buffer on devices defaulting to 15-Adobe-Helvetica would be the better solution (those devices usually have more RAM anyway). In any way, I want my player to power up *fast*, and given the fact that we *always* boot the player which is slower than Apples sleep mode we *need* to be fast. An Ipod user experiencing boot times with 6 seconds only for loading the font (which I guess will get at least around 10 seconds with the apple bootloader and other loading stuff that has to happen) is likely to turn away because the Apple firmware "boots" almost instantly.
A short check with stopwatch timing: nano2g: 2 sec (boot from iloader menu), mini2g with CF mod: 6sec (complete boot with Rockbox bootloader), OF: instantly. And that is with a font that fits into the buffer.
Fixing font cache to be faster is of course the best solution; however I disagree with making boot slower just for loading glyphs most likely the majority of users never need. We need to make booting faster, not slower (that's also a reason why a graphical bootloader is bad)
Caching is not slow because it loads too many glyphs; it's slow because it does it in a completely naieve way. The most recently used glyphs are loaded, *one at a time*, in *order of how recently used they were*. This causes hundreds/thousands of seeks, and provokes absolute worst case behaviour from the 1024-byte-sector emulation code used on the iPod 5.5G. Just sorting the list by index before saving it would likely improve the speed substantially.
If this was just a matter of 100-200ms on disk targets (and less on flash) then I wouldn't really care *too* much, but the fact that it adds 6 entire seconds on 5.5G is just insane and I don't think any argument about keeping users with non-ascii characters happy justifies it.
I would say that in the long term we should both fix the font caching code to work less horribly, and decide *which* character sets should be included by default, and then adjust *all* the versions of the font to match: add characters if there are missing ones on some versions, and remove characters if there are gratuitously too many on others... but I really think we should do something in the short term as well.
Fixing glyphcache to actually be a proper on disk cache instead of just a list of indicies would probaly speed font loading up alot.
I tihnk the best option is maybe to just load a cut down version by default and if a glyph is needed then at that point we load the full version of the font. (or when disk is inactive even)
I think this is a reasonable compromise until we work out how to fix the font cache: users who currently use small fonts will see no difference. I'd like some testing and review of the patch, and I'd also like comments on what a suitable max/min size should be for the different memory sizes: at the moment the values I have used just increase the maximum to 300000 bytes for players with 32MB or more of memory, which I believe covers the problematic ones here, but we should probably think about decent choices across the whole range of memory size.
It works fine in "normal" use cases though. I'll fix it at some point.
Thanks!
The patch is buggy and probably not a great solution anyway; there's no need to make a change that complicated just to make the font buffer bigger on your player.
You can measure boot time and all its stages precisely using bootchart: pick it from the advanced settings during configure and it will logf() a series of boot time measurements, and this can be viewed or dumped to disk in the debug menu. There are some scripts to graph it as well on the wiki, but it should be easy enoguh to pick the font_load out.
Now skips loading the part of the glyph cache that doesn't fit in memory
Increased the block size to 256
Reload the glyphs in LRU order after loading in disk order to preserve LRU order.
The logic to skip writing out invalid glyphs is broken when the first character is not zero.
If it helps, today I've tried to increase MAX_FONT_SIZE to 300000 (like in your patch) in a fresh font.c file, and it loads VERY slow like in the standard build (25 to 30 seconds). After that, I've re-synched your entire patch with the actual font.c and it loads that slow too.
With the other patches (glyph_xxxxxx.diff) I haven't noticed any speedup.
Please note that glyph_writeout_fix.diff is just to stop the creation of .glyphcache with thousands of extra 0x001f's. You want glyph_cache_diskorder_v3.diff for the loading speed up.
I use in my wps very large fonts, although the fnt files sizes are between 130-170kb.
%Fl(2,ter-u28b.fnt)
%Fl(3,16-Terminus-Bold.fnt)
(and the system font)
In my sbs I use
%Fl(3,16-Terminus-Bold.fnt)
(and the system font)
I've tried the glyph_cache_diskorder_v4.diff patch, after re-synching it, and it still loads in the 25-30 seconds range.
***SOLVED before submit this post, after notice that the glyphcache files are very old.
1304 2010-07-10 14:16 .glyphcache
150 2009-09-15 17:40 .glyphcache-brwsr
8 2009-09-15 17:40 .glyphcache-menu
0 2009-09-15 17:40 .glyphcache-record
0 2009-09-15 17:40 .glyphcache-tuner
58 2009-09-15 17:40 .glyphcache-wps
I've deleted all of them and it loads fast again in about 10 seconds. I was very frustrated with this, but now it's ok.
Thank you all.
Included the glyph file write fix.
This bug was closed as it was supposed to be fixed in r27864, but according to my tests with bootchart r27864 and r27863 on my device takes exactly same amount of time to load 15-Adobe-Helvetica:
-On fresh install font takes 1.0s to load
-After viewing contents of my music folder, which has filenames with cyrillic and grek characters, loading font start to take 3.8s
Then after around r27920 behaviour changes and keeps the same until latest svn (r28850):
-On fresh install 15-Adobe-Helvetica loads slightly over 6 seconds
-After viewing music library contents the font start to take 7.5s to load
I've been using my custom build with MAX_FONT_SIZE increased to 300000 for a couple of weeks and it loads much faster: font loading take only 0.15s. Much more smoother :)