Open Bug 2030982 Opened 4 months ago Updated 3 months ago

Searching for 'await' on the ECMA262 specification is very janky, and profiler says mutation + layout (due to ToC change causing recalculation of the whole list-item counter list, which is ~35k elements)

Categories

(Core :: Layout: Generated Content, Lists, and Counters, defect, P3)

defect

Tracking

()

Tracking Status
firefox-esr115 --- wontfix
firefox-esr140 --- wontfix
firefox149 --- wontfix
firefox150 --- wontfix
firefox151 --- wontfix

People

(Reporter: mgaudet, Unassigned)

References

(Regression)

Details

(Keywords: regression)

STR: Visit https://tc39.es/ecma262/ and do in page search for await, then hit cmd-g for next result repeatedly. Huge janks every once and a while (also curiously the number of matches will change from "more than 1000" to 1 repeatedly)

Profile: https://share.firefox.dev/4vm9hW7

Menu.prototype.revealInToc seems relevant.

I will note I have 1PW installed which I've previously seen being an issue with mutation observers.

Uhhh so I guess it's this code or equivalent?

That code is rather bad, modifying styles and calling getBoundingClientRect in a loop :)

Where is spec.css? This is hitting basically a full counter rebuild every loop iteration...

Flags: needinfo?(mgaudet)

I guess it's this

Flags: needinfo?(mgaudet)

Ok, I can reproduce locally. It's not about await in particular but about revealing large parts of the TOC. I don't see off-hand why that would trigger a full counter recalc...

(In reply to Emilio Cobos Álvarez [:emilio] from comment #3)

I guess it's this

That seems likely (t.b.h I've never edited spec CSS outside of putting comic sans as an inline style to make sure people didn't take my vague gesturing at spec text too seriously)

If the CSS is bad though, I'm sure an issue at https://github.com/tc39/ecma262/issues/ could also get that sorted

So I took a look, and the counter is list-item. The list item counter list has ~35k elements, and each time we're inserting a counter (by showing part of the TOC) we end up hitting this codepath.

That goes back all the way to the initial implementation of CSS counters in bug 3247... But we started using it for lists in bug 1706346.

We are going to need have a better story for counter invalidation. Inserting a reset node should only invalidate its scope.

Severity: -- → S3
Component: Layout → Layout: Generated Content, Lists, and Counters
Keywords: regression
Priority: -- → P3
Regressed by: 1706346
See Also: → 3247, 1706346
Summary: Searching for 'await' on the ECMA262 specification is very janky, and profiler says mutation + layout → Searching for 'await' on the ECMA262 specification is very janky, and profiler says mutation + layout (due to ToC change causing recalculation of the whole list-item counter list, which is ~35k elements)

Set release status flags based on info from the regressing bug 1706346

See Also: → 1897782
You need to log in before you can comment on or make changes to this bug.