Closed Bug 1989851 Opened 1 year ago Closed 1 year ago

More performance optimization for text-autospace

Categories

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

enhancement
Points:
1

Tracking

()

RESOLVED FIXED
145 Branch
Tracking Status
firefox145 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

(Whiteboard: [jp-mvp])

Attachments

(3 external files)

As noted in bug 1987997 comment 8, svg-text-textLength-1.html can cause perf_reftest_singletons talos test suites time out intermittently on Linux, which is blocking enabling text-autospace on Nightly.

The performance regression occurs after bug 1986837. Specifically, the 8-bit text optimization is removed in Bug 1986837 patch 2, and determining the autospace in the preceding content takes more time.

valueOr() unconditionally evaluates its parameter, so we should use
valueOrFrom() to call findPrecedingClass() only when needed.
See the documentation:
https://searchfox.org/firefox-main/rev/36ebbdf6fbbfd0b40a607212ec843992b5d43e92/mfbt/Maybe.h#504-509

With layout.css.text-autospace.enabled=true, on my local Linux machine, the
running time of
testing/talos/talos/tests/perf-reftest-singletons/svg-text-textLength-1.html
drops from 29,425ms to 22,279ms (~24% faster).

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED

If word-spacing is zero, we don't need to call IsCSSWordSpacingSpace() at
all.

With layout.css.text-autospace.enabled=true, on my local Linux machine, the
the running time of
testing/talos/talos/tests/perf-reftest-singletons/svg-text-textLength-1.html
drops from 22,279 ms to 19,274 ms (~13% faster).

The second and subsequent characters cannot be ideographs in a 1-byte text.

With layout.css.text-autospace.enabled=true, on my local Linux machine, the
running time of
testing/talos/talos/tests/perf-reftest-singletons/svg-text-textLength-1.html
drops from 19,274 ms to 13,052 ms (~32% faster).

Here's a performance comparison for perf_reftest_singletons on Windows (base = text-autospace enabled, new = text-autospace enabled + the patches in this bug).

The two subtests most impacted by text-autospace show substantial gains:

  • bidi-resolution-1.html: ~15% improvement
  • svg-text-textLength-1.html: ~42% improvement

The optimizations here are great, thank you! Hopefully this will let us turn on the pref for wider testing without further problems.

Pushed by tlin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/eafe10d94e80 https://hg.mozilla.org/integration/autoland/rev/fc4ef6354775 Part 1 - Avoid unnecessary findPrecedingClass() calls. r=jfkthame,layout-jp-market-reviewers,layout-reviewers,emilio https://github.com/mozilla-firefox/firefox/commit/ac8e030f7c7c https://hg.mozilla.org/integration/autoland/rev/97f05001d655 Part 2 - Check mWordSpacing before calling IsCSSWordSpacingSpace(). r=jfkthame,layout-jp-market-reviewers,layout-reviewers https://github.com/mozilla-firefox/firefox/commit/7380fbe57e1f https://hg.mozilla.org/integration/autoland/rev/6c63924355bd Part 3 - Run text-autospace for 1-byte text only at the start of the frame. r=jfkthame,layout-jp-market-reviewers,layout-reviewers
Points: --- → 1
Whiteboard: [jp-triage] → [jp-mvp]
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 145 Branch
QA Whiteboard: [qa-triage-done-c146/b145]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: