Optimize canvas2d text drawing for purely-LTR strings
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox112 | --- | fixed |
People
(Reporter: jfkthame, Assigned: jfkthame)
References
(Blocks 1 open bug)
Details
Attachments
(7 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
I think we can (marginally) improve Canvas text performance for common cases by avoiding some of the Unicode bidi processing for strings that are known to be purely LTR.
We already have a simplified code path used for single-character strings (introduced because pdf.js likes to paint each character individually, so this is a hot path), but I think we can extend that to also cover longer strings where no potentially-bidi content is present.
In local testing on macOS, this gives me about a 2.5% improvement on the old IETestDrive Preschool demo mentioned in bug 932613.
Assignee | ||
Comment 1•2 years ago
|
||
No functional change, just a drive-by cleanup noticed when looking over the text-rendering APIs.
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
I guess this used to be needed somewhere, but it's long dead now.
Removing the parameter makes it clear that the caller doesn't need
to compute and pass it.
Depends on D171984
Assignee | ||
Comment 3•2 years ago
|
||
This function doesn't need a Bidi engine, it just does property lookups
via the intl API. So drop the redundant parameter.
Depends on D171985
Assignee | ||
Comment 4•2 years ago
|
||
This avoids an extra string copy/scan in ProcessText, by including the block/segment
separators it cares about in the preprocessing that's already being done to normalize
whitespace characters by the caller.
Depends on D171986
Assignee | ||
Comment 5•2 years ago
|
||
Just to reduce visual clutter in the code, for readability.
Depends on D171987
Assignee | ||
Comment 6•2 years ago
|
||
This is the significant change here: extend the single-character fast-path that skips
bidi processing to also handle strings that are confirmed to have no bidi content.
In such cases, we don't need to pass the text to a Bidi engine for analysis at all.
Depends on D171988
Assignee | ||
Comment 8•2 years ago
|
||
Comment 9•2 years ago
|
||
Backed out changeset 6fdd0782eb8d for causing build bustage
Comment 10•2 years ago
|
||
Comment 11•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/bcc2e31546e8
https://hg.mozilla.org/mozilla-central/rev/b618fa47868b
https://hg.mozilla.org/mozilla-central/rev/a9888772a4e1
https://hg.mozilla.org/mozilla-central/rev/1926e59c9e75
https://hg.mozilla.org/mozilla-central/rev/5fd91fb4cb3b
https://hg.mozilla.org/mozilla-central/rev/7f486b8078ac
Comment 12•2 years ago
|
||
Comment 13•2 years ago
|
||
bugherder |
Assignee | ||
Updated•2 years ago
|
Description
•