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. 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](https://profiler.firefox.com/public/qmszev8qed8vmts9qgvpvm169jw714rvdvap6a8/flame-graph/?globalTrackOrder=0w2&hiddenGlobalTracks=01&hiddenLocalTracksByPid=8962-0w5&profileName=Firefox%20Firefox-vs-WebKit&symbolServer=http%3A%2F%2F127.0.0.1%3A3000%2F23jixchdmscjv09qbfbpk23nh6nk4kwh755mdjw&thread=3&transforms=fs-m--async%2C-sync~df-4474~df-8899~df-69622~df-4472~df-9158~df-14715~df-90991~df-4475~df-4476~df-1615~df-84036~df-3457~fs-m-suite-Editor-TipTap~ff-3782~rec-3782&v=12) which he suggests may not be as well optimized, as they're apparently [an Apple thing](https://en.wikipedia.org/wiki/Apple_Advanced_Typography).
Bug 2005283 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
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](https://profiler.firefox.com/public/qmszev8qed8vmts9qgvpvm169jw714rvdvap6a8/flame-graph/?globalTrackOrder=0w2&hiddenGlobalTracks=01&hiddenLocalTracksByPid=8962-0w5&profileName=Firefox%20Firefox-vs-WebKit&symbolServer=http%3A%2F%2F127.0.0.1%3A3000%2F23jixchdmscjv09qbfbpk23nh6nk4kwh755mdjw&thread=3&transforms=fs-m--async%2C-sync~df-4474~df-8899~df-69622~df-4472~df-9158~df-14715~df-90991~df-4475~df-4476~df-1615~df-84036~df-3457~fs-m-suite-Editor-TipTap~ff-3782~rec-3782&v=12) which he suggests may not be as well optimized, as they're apparently [an Apple thing](https://en.wikipedia.org/wiki/Apple_Advanced_Typography).