Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category User Interface → Font/charset
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Defer
  • Reported Version Release 3.9
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by freddyb - 2011-10-14
Last edited by freddyb - 2011-10-17

FS#12333 - Faster cached font loading

When 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.

Closed by  freddyb
2011-10-17 15:48
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

in 30769.

Resync to SVN.
Update convbdf.c c source generation to include extra structure members.

I’m not sure I understand this patch correctly.

- 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?

Lseek() can be cheap or expensive depending on if the seek is outside of the cache.
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.

Resynced and simplified glyph_cache_load() by removing some of the old glyph presorting code which will no longer be necessary.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing