Optimize gfxHarfBuzzShaper::ShapeText if possible, for Editor-TipTap
Categories
(Core :: Layout: Text and Fonts, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox117 | --- | fixed |
People
(Reporter: mstange, Assigned: jfkthame)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sp3])
Attachments
(3 files, 1 obsolete file)
On Windows, 20% of the time on the Speedometer 3 subtest "Editor-TipTap" is spent inside the function gfxHarfBuzzShaper::ShapeText
. Reducing the time in this function would have an appreciable impact on the score of that subtest.
Profile: https://share.firefox.dev/3pZqFD9 (double-click a function to view line-by-line timings)
https://shell--speedometer-preview.netlify.app/?suite=Editor-TipTap&iterationCount=100
I should note that we are already faster than Chrome at layout on this subtest, but this may not remain so indefinitely, and a percent is a percent.
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
A couple of things catch my eye in this profile that may be worth exploring:
First, gfxDWriteFont::GetGlyphWidth
currently uses an nsTHashMap
to cache glyph widths for the font; we could switch this to mozilla::HashTable
, which should be faster, and/or we could experiment with layering a fast MRUCache
in front of the hashtable.
We could also try an MRUCache
to accelerate gfxHarfBuzzShaper::GetNominalGlyph
.
The other thing that stands out is gfxFontShaper::MergeFontFeatures
, which again is heavy on hashtable work. We could use mozilla::HashTable
for a faster implementation, but I think a better way will be to use a simple sorted array to accumulate the features. No real-world content is likely to have so many separate features specified that we really need the hashtable.
I'll experiment with some patches along these lines.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
Assignee | ||
Comment 3•2 years ago
|
||
Depends on D184101
Assignee | ||
Comment 4•2 years ago
|
||
Depends on D184102
Assignee | ||
Comment 5•2 years ago
|
||
With the patches above, the Editor-TipTap score in my local (non-PGO) build rises from 6.806 to 7.252, which seems a healthy win.
Reporter | ||
Comment 6•2 years ago
|
||
Very nice!
Assignee | ||
Comment 7•2 years ago
|
||
We need to do this in order to add internal caches to the shaper
(without a lot of thread-safety pain).
Updated•2 years ago
|
Comment 9•2 years ago
•
|
||
Backed out 4 changesets (Bug 1844464) for causing failures on test_offscreencanvas_font.html CLOSED TREE
Logs: https://treeherder.mozilla.org/logviewer?job_id=423453067&repo=autoland&lineNumber=2211
https://treeherder.mozilla.org/logviewer?job_id=423465103&repo=autoland&lineNumber=8219
Reftest: https://treeherder.mozilla.org/logviewer?job_id=423463006&repo=autoland&lineNumber=4125
Backout: https://hg.mozilla.org/integration/autoland/rev/e0a7f85b89aaa94526bb26ec54c1000e71b91981
Updated•2 years ago
|
Assignee | ||
Comment 10•2 years ago
|
||
Revised patches to avoid the need to hold the gfxFont lock, which was leading to possible-deadlock warnings.
Comment 11•2 years ago
|
||
Comment 12•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/12d609f24c16
https://hg.mozilla.org/mozilla-central/rev/a0c8264fc96a
https://hg.mozilla.org/mozilla-central/rev/4a7e5d260b93
Description
•