Closed
Bug 1352531
Opened 8 years ago
Closed 8 years ago
can mozilla::dom::FontFaceSet::FindOrCreateUserFontEntryFromFontFace be faster?
Categories
(Core :: DOM: CSS Object Model, defect)
Core
DOM: CSS Object Model
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox55 | --- | fixed |
People
(Reporter: dbaron, Assigned: heycam)
References
(Blocks 1 open bug)
Details
(Keywords: perf)
Attachments
(3 files)
|
18.53 KB,
patch
|
ehsan.akhgari
:
feedback+
|
Details | Diff | Splinter Review |
|
18.58 KB,
patch
|
Details | Diff | Splinter Review | |
|
59 bytes,
text/x-review-board-request
|
dbaron
:
review+
|
Details |
In the profile in bug 1329601 comment 13 I noticed that we're spending a substantial amount of time in mozilla::dom::FontFaceSet::FindOrCreateUserFontEntryFromFontFace, most of which is spent in memory allocation and freeing.
Could this be made any faster?
Here's a slice of the profile focusing on this: https://perfht.ml/2oqedI5
Flags: needinfo?(jfkthame)
| Assignee | ||
Comment 1•8 years ago
|
||
That seems to indicate that it's Block objects inside gfxSparseBitSet / gfxCharacterMap, which is for compact unicode-range value storage.
There might be ways of improving gfxSparseBitSet, but if are recreating the gfxCharacterMap object for the same FontFace often, we could just cache its value on the FontFace, and update or invalidate it when the descriptors on the FontFace are changed.
| Assignee | ||
Comment 3•8 years ago
|
||
| Reporter | ||
Comment 4•8 years ago
|
||
Comment on attachment 8853617 [details] [diff] [review]
WIP v0.1
It's hard for me to tell if it helps; I was actually looking at a profile that Ehsan took, and I haven't even gotten the profiler working on my primary machine.
Maybe Ehsan can tell, though?
Attachment #8853617 -
Flags: feedback?(dbaron) → feedback?(ehsan)
| Reporter | ||
Updated•8 years ago
|
Whiteboard: [qf:?]
Updated•8 years ago
|
Whiteboard: [qf:?] → [qf]
Updated•8 years ago
|
Whiteboard: [qf] → [qf:p1]
| Assignee | ||
Comment 5•8 years ago
|
||
Ehsan, could you try this patch, or give me some instructions so I can see if it helps whatever workload you were profiling? Thanks!
Flags: needinfo?(jfkthame) → needinfo?(ehsan)
Comment 6•8 years ago
|
||
FWIW this profile came from the test case linked to in bug 1269695 comment 10. The STR is in the bug. I'm doing a build to test.
Comment 7•8 years ago
|
||
This is a profile from a build before your changes: https://perfht.ml/2pENdoI
We spend 24ms in FindOrCreateUserFontEntryFromFontFace.
This is a profile from a build after your changes: https://perfht.ml/2oXxLGx
The function doesn't show up in the profile any more!
So your patch helps make the function much faster, and if there is no downsides with it we should land it, but it doesn't improve anything in the grand scheme of things...
Flags: needinfo?(ehsan)
Comment 8•8 years ago
|
||
Comment on attachment 8853617 [details] [diff] [review]
WIP v0.1
BTW super sorry for the long delay here.
Attachment #8853617 -
Flags: feedback?(ehsan) → feedback+
Comment 9•8 years ago
|
||
(In reply to :Ehsan Akhgari (super long backlog, slow to respond) from comment #7)
> So your patch helps make the function much faster, and if there is no
> downsides with it we should land it, but it doesn't improve anything in the
> grand scheme of things...
Sorry, I think this came out negatively but I didn't mean it that way! I meant to say that this test case is really really slow. But of course it's not this function's fault. :-)
| Assignee | ||
Comment 10•8 years ago
|
||
(In reply to :Ehsan Akhgari (super long backlog, slow to respond) from comment #9)
> Sorry, I think this came out negatively but I didn't mean it that way! I
> meant to say that this test case is really really slow. But of course it's
> not this function's fault. :-)
No worries, thanks for testing. :-)
Since the patch doesn't need any more work, may as well get it landed.
| Assignee | ||
Comment 11•8 years ago
|
||
This is the same as the WIP patch.
| Reporter | ||
Comment 12•8 years ago
|
||
Comment on attachment 8859860 [details] [diff] [review]
patch
>+ // FIXME(heycam): If we are changing unicode-range, then a FontFace object
>+ // representing this rule must have its mUnicodeRange value invalidated.
Do you need to fix this? (This is a regression from this bug, right, in that you don't have any code to set mUnicodeRangeDirty to true other than the constructor?)
Flags: needinfo?(cam)
| Assignee | ||
Comment 13•8 years ago
|
||
I guess that comment is misplaced, since nsCSSFontFace::SetDesc is only called from nsCSSParser when parsing the rule initially. nsCSSFontFaceStyleDecl::SetProperty is where we should be noting that we need to handle dynamic updates.
But we do support modifying unicode-range through FontFace::SetUnicodeRange, and we correctly flush the font set in that case. So I need to set mUnicodeRangeDirty there.
Flags: needinfo?(cam)
| Reporter | ||
Comment 14•8 years ago
|
||
Comment on attachment 8859860 [details] [diff] [review]
patch
OK, cancelling review until comment 13 is done.
Attachment #8859860 -
Flags: review?(dbaron)
| Assignee | ||
Comment 15•8 years ago
|
||
(Oh, I made the change but forgot to upload the patch. Needinfo to remind myself to upload it when I'm back at the computer the patch is on...)
Flags: needinfo?(cam)
| Comment hidden (mozreview-request) |
| Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(cam)
| Reporter | ||
Comment 17•8 years ago
|
||
| mozreview-review | ||
Comment on attachment 8860911 [details]
Bug 1352531 - Make dom::FontFace cache its gfxCharacterMap instead of rebuilding it every time.
https://reviewboard.mozilla.org/r/131944/#review139368
Attachment #8860911 -
Flags: review?(dbaron) → review+
Comment 18•8 years ago
|
||
Pushed by cmccormack@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3c4e4f95b499
Make dom::FontFace cache its gfxCharacterMap instead of rebuilding it every time. r=dbaron
Comment 19•8 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•3 years ago
|
Performance Impact: --- → P1
Whiteboard: [qf:p1]
You need to log in
before you can comment on or make changes to this bug.
Description
•