Wednesday, March 18, 2015

[eadqhbxr] Faster text wrap

Hypothesize that one of the most CPU intensive tasks of rendering a web page (and thus one of the causes of delays, especially on mobile devices) is wrapping paragraphs to fit within margins. It is inherently serial: we cannot know the vertical location of the next paragraph until the current one has been finished.

This problem could be avoided with a fixed width font and wrapping at a character instead of word wrap: just count bytes.  Unicode UTF-8 ruins things, though one ugly solution is for characters that require more than one byte to be simply rendered wider, perhaps padded with spaces.

Similarly, we could still use proportional width fonts, but wrap them as if fixed width.  The right margin will be ugly, but ugly may be worth the tradeoff for rendering speed.

No comments :