Open Bug 934770 Opened 6 years ago Updated 11 months ago

divide large text runs into smaller runs to avoid chrome hangs

Categories

(Core :: Layout: Text and Fonts, defect, P3, major)

defect

Tracking

()

People

(Reporter: jtd, Unassigned)

References

(Blocks 2 open bugs)

Details

(Keywords: perf)

Tinderbox logfile with text perf logging enabled:

(presshell) 122409000 begin load [https://tbpl.mozilla.org/php/getParsedLog.php?id=30024572&tree=Mozilla-Central&full=1]
(textperf-reflow) 0x122409000 time-ms:    165.29 reflow: 1 content-textruns: 7 chrome-textruns: 0 chars: 218490 max-textrun-len: 218334 word-cache-lookups: 18254 word-cache-hit-ratio: 0.833 word-cache-space: 0 word-cache-long: 1448 pref-fallbacks: 0 system-fallbacks: 0
(textperf-reflow) 0x122409000 time-ms:    478.03 reflow: 2 content-textruns: 190 chrome-textruns: 0 chars: 547790 max-textrun-len: 539400 word-cache-lookups: 48272 word-cache-hit-ratio: 0.945 word-cache-space: 0 word-cache-long: 3735 pref-fallbacks: 0 system-fallbacks: 0
(textperf-reflow) 0x122409000 time-ms:   1003.27 reflow: 5 content-textruns: 3 chrome-textruns: 0 chars: 1004331 max-textrun-len: 1004058 word-cache-lookups: 87048 word-cache-hit-ratio: 0.920 word-cache-space: 0 word-cache-long: 7676 pref-fallbacks: 0 system-fallbacks: 0
(textperf-reflow) 0x122409000 time-ms:   3063.15 reflow: 8 content-textruns: 4157 chrome-textruns: 0 chars: 3476958 max-textrun-len: 708855 word-cache-lookups: 319828 word-cache-hit-ratio: 0.927 word-cache-space: 1724 word-cache-long: 22847 pref-fallbacks: 3448 system-fallbacks: 0
(textperf-reflow) 0x122409000 time-ms:  33517.60 reflow: 10 content-textruns: 74 chrome-textruns: 0 chars: 32171697 max-textrun-len: 20274371 word-cache-lookups: 2974573 word-cache-hit-ratio: 0.936 word-cache-space: 25 word-cache-long: 204409 pref-fallbacks: 50 system-fallbacks: 7
(presshell) 122409000 end load time-ms:  39899.49 [https://tbpl.mozilla.org/php/getParsedLog.php?id=30024572&tree=Mozilla-Central&full=1]
(textperf-loaddone) 0x122409000 reflow: 12 content-textruns: 4431 chrome-textruns: 0 chars: 37419266 max-textrun-len: 20274371 word-cache-lookups: 3447975 word-cache-hit-ratio: 0.934 word-cache-space: 1749 word-cache-long: 240115 pref-fallbacks: 3498 system-fallbacks: 7
(textperf) 0x122409000 reflow: 12 content-textruns: 4431 chrome-textruns: 0 chars: 37419266 max-textrun-len: 20274371 word-cache-lookups: 3447975 word-cache-hit-ratio: 0.934 word-cache-space: 1749 word-cache-long: 240115 pref-fallbacks: 3498 system-fallbacks: 7

The key item here is that one of the reflows is shaping a textrun 20,274,371 bytes long!  This will definitely cause a chrome hang.  It turns out pre elements and raw text files are both handled this way.

We need to slice up text runs when they get too large and we need to do it in a way that can be cached efficiently to avoid reconstructing the same textrun multiple times.
This sounds a lot like bug 386122.  I guess there we made scrolling faster but the initial pageload was still allocating the giant textrun?
Keywords: perf
Priority: -- → P3
Yes. I don't know why we're creating a giant textrun here, unless the log contains one incredibly long line somewhere.
Blocks: 942832
Blocks: 860492
Simple testcase for generating large text elements:

generate 1000 character block
http://people.mozilla.org/~jdaggett/tests/generatetext.html?size=1000

generate 10mb character block
http://people.mozilla.org/~jdaggett/tests/generatetext.html?size=10mb
Blocks: 950526
Blocks: 962412
Severity: normal → major
Duplicate of this bug: 1228469
The log from bug 1228469 has one line that is 20k long. 1% of the lines are > 4k long.
Duplicate of this bug: 1247080
You need to log in before you can comment on or make changes to this bug.