Is WebKit shaping 50x faster than Firefox?
Categories
(Core :: Graphics: Text, task)
Tracking
()
People
(Reporter: mgaudet, Unassigned)
References
(Blocks 1 open bug)
Details
Looking at the SP3 test Editor-TipTap, one thing that's notable is that we have lots of samples inside Harfbuzz, specifically in gfxHarfBuzzShaper::ShapeText. Trying to find an equivalent call for a profile of WebKit, and the closest I can find is CTFontShapeGlyphs. But across a 200 iteration run of Sp3 we see 54x more samples in Harfbuzz relative to CTFontShapeGlyphs.
Here are two profiles to look at:
- Safari: https://share.firefox.dev/4a0cKBq
- Firefox: https://share.firefox.dev/48LGAaJ
It seems likely that I'm actually trying to compare incomparable things here, but I'm opening this bug because if it were accurate, this might be a 2% win on Editor-TipTap.
I asked Jonathan Kew what's his thoughts were, and he mentioned two things:
Are we actually shaping the same text content with the same font resource? If the browsers are using different fonts (e.g. because the test uses generic font-family names, and the font defaults are configured differently), results are not comparable. E.g. if one font has kerning and ligatures, and the other doesn't, the cost of shaping may legitimately be significantly different.
Perhaps more likely, the test is doing something that causes us to discard and re-create text frames frequently, and webkit manages to avoid that (e.g. making incremental updates rather than rebuilding everything), so the real difference is at a higher level than shaping.
I don't have good answers to this; but if anyone does want to look into this, I thought they were good points to keep in mind.
One other note from Jeff is that Harfbuzz is dealing with an AAT font from the profile which he suggests may not be as well optimized, as they're apparently an Apple thing.
Comment 1•3 days ago
|
||
AAT shaping in HarfBuzz is pretty fast -- Behdad has done some substantial optimization there in recent releases. So while it's always worth looking, I seriously doubt that it's many times slower than Core Text.
Description
•