Closed Bug 1882790 Opened 2 years ago Closed 2 years ago

Optimize bidi resolution where possible

Categories

(Core :: Layout: Text and Fonts, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
125 Branch
Tracking Status
firefox125 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(2 files)

Profiling and reading the nsBidiPresUtils code, I've noticed some minor inefficiencies that we can improve; patches incoming.

We don't need to explicitly drop bidi-control frames from the original list in BidiLineData,
and make the corresponding updates to the Levels and IndexMap arrays; instead, we can just
skip over them when building the VisualFrames array.

Also, in nsBidiPresUtils::ReorderFrames we don't need a BidiLineData at all if there's only
a single frame on the line; we can just call RepositionFrame directly.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED

In nsBidiPresUtils::ResolveParagraph, we replace any block or segment separators
with space characters before bidi resolution. The use of nsString::ReplaceChar
here can appear in profiles, so it seems worth having a custom accelerated version
to handle the fixed set of separator codes. My local testing indicates this runs
between 5 and 10 times faster than the general-purpose function that has to
iterate over the provided set of characters at runtime.

Blocks: 1880487, 1880633
Blocks: 1883464
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6e0be8c8b999 Cleanup and optimize BidiLineData handling. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/ccd673b111a7 Use a custom ReplaceSeparators function in place of nsString::ReplaceChar during bidi resolution. r=layout-reviewers,emilio

Backed out for causing build bustage on nsBidiPresUtils.cpp

Backout link

Push with failures

Failure log

Flags: needinfo?(jfkthame)
Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cb08b842d8fd Cleanup and optimize BidiLineData handling. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/300643546ea8 Use a custom ReplaceSeparators function in place of nsString::ReplaceChar during bidi resolution. r=layout-reviewers,emilio
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch
Regressions: 1883935
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: