This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#12333 - Faster cached font loading
Attached to Project:
Rockbox
Opened by Fred Bauer (freddyb) - Friday, 14 October 2011, 05:14 GMT+2
Last edited by Fred Bauer (freddyb) - Monday, 17 October 2011, 17:48 GMT+2
Opened by Fred Bauer (freddyb) - Friday, 14 October 2011, 05:14 GMT+2
Last edited by Fred Bauer (freddyb) - Monday, 17 October 2011, 17:48 GMT+2
|
DetailsWhen font glyphs are loaded from disk there are 3 file sections to read from: width data, offset data, and bitmap data. The number of disk seeks can be very much reduced by opening the font file with three separate file descriptors, each of which have a small cache. This is a small patch that opens additional file descriptors for width and offset data during glyph_cache_load(). The fd's are closed after the initial load so it only uses two extra fd's for a short time. It's a bit of a kludge but it increases initial glyph loading speed about 600% for a cached font.
|
This task depends upon
Closed by Fred Bauer (freddyb)
Monday, 17 October 2011, 17:48 GMT+2
Reason for closing: Accepted
Additional comments about closing: in 30769.
Monday, 17 October 2011, 17:48 GMT+2
Reason for closing: Accepted
Additional comments about closing: in 30769.
Update convbdf.c c source generation to include extra structure members.
- Does this change the font structure in a way that existing fonts are incompatible?
- Is lseek() that bad? I thought it was bad if the underlying disk needs to actually seek. I don't see how multple FDs can help the disk there. Also you don't actually reduce lseek() calls do you?
When a font loads a glyph it does the following:
1) reads 1 byte from the width section of the file
2) reads 2-4 bytes from the offset section of the file
3) reads the bitmap data pointed to by the offset
4)...next glyph
The default font preload without a .glyphcache file is to load 224 glyphs and some fonts are spread over 100,000's of bytes. The seeks are mostly cache misses because the read locations are round-robin.
Opening separate file handles for width, offset, and bitmap data gives you a small amount of cache for each section so that width and offset data would only be lseeked a few times as each seek/read is hitting the same cache repeatedly. It's not about having multiple fd's, but having three caches.
The font files do not change.