Skip to content
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

See if we can cache text measurements #191

Closed
pcwalton opened this issue Nov 10, 2012 · 4 comments
Closed

See if we can cache text measurements #191

pcwalton opened this issue Nov 10, 2012 · 4 comments

Comments

@pcwalton
Copy link
Contributor

@pcwalton pcwalton commented Nov 10, 2012

We spend about 25% of our time during reflow in lipsum re-measuring text. We can probably do something clever to cache this. (What do Gecko and WebKit do?)

@burg
Copy link

@burg burg commented Nov 10, 2012

The obvious thing to do is to make a side table which stores precomputed widths of contiguous glyph ranges between hyphenation or line break opportunities. I'm not sure whether this will scale well once we consider line breaks at more places than just whitespace.

On Nov 10, 2012, at 10:33 , Patrick Walton wrote:

We spend most of our time during reflow in lipsum re-measuring text. We can probably do something clever to cache this. (What do Gecko and WebKit do?)


Reply to this email directly or view it on GitHub.

@rocallahan
Copy link

@rocallahan rocallahan commented Nov 11, 2012

In Gecko we cache preshaped "words" (delimited by whitespace) --- this includes not just advance widths but also glyph IDs and positions. Then for a given DOM we build a set of "text runs" --- runs of text with the same font, size, style etc, possibly spanning DOM node node boundaries --- where a text run contains the advance widths, glyph IDs and positions obtained from the words in the text run.

@burg
Copy link

@burg burg commented Nov 12, 2012

@rocallahan That is basically what's implemented, modulo the ShapedWord cache. It seems that the most costly part of the profile is spent summing advances during line breaking, since it's a page full of text. I was able to reduce the time a bit more with some inline hints.

@mbrubeck
Copy link
Contributor

@mbrubeck mbrubeck commented May 24, 2016

We now have a shaped word cache, and #8990 added caching of advances at various levels.

@mbrubeck mbrubeck closed this May 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.