Closed Bug 1949094 Opened 1 year ago Closed 1 year ago

Nightly is 3.25x slower than Chrome to paste text on https://quilljs.com/playground/snow

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: mayankleoboy1, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

Attached file reasonable css.txt —

Go to https://quilljs.com/playground/snow
Copy-paste the attached sample text.

Nightly: https://share.firefox.dev/4hHeMqV (26s)
Chrome: https://share.firefox.dev/41nuRwc (8s)

A very large chunk of this is Ion JIT code for the uA function and it's a little surprising we're that much slower. I'll take a quick look.

Flags: needinfo?(jdemooij)

Mayank, are you sure those numbers are right? Can you reproduce that also without the profiler?

What I see here on Mac is ~8 seconds in Chrome, ~14 seconds in Nightly. Slower but not 3x slower.

Flags: needinfo?(mayankleoboy1)

This is what i get on a frehs profile : https://share.firefox.dev/4k152JL
I also timed it using a stopwatch and disabling the profiler and got roughly the same 20s.

Flags: needinfo?(mayankleoboy1)

I looked at the code Ion generates for this uA function and we generate fairly decent code for most of the hot blocks - I didn't see any obvious low hanging fruit. Some of these blocks are executed > 1.8 billion times so small codegen issues might have a larger effect than you'd normally expect. This function also seems to walk a large tree or graph of JS objects so some of the overhead might be from cache misses.

            function uA(e) {
                e: for (;;) {
                    for (; null === e.sibling;) {
                        if (null === e.return || u$(e.return)) return null;
                        e = e.return
                    }
                    for (e.sibling.return = e.return, e = e.sibling; 5 !== e.tag && 6 !== e.tag && 18 !== e.tag;) {
                        if (2 & e.flags || null === e.child || 4 === e.tag) continue e;
                        e.child.return = e, e = e.child
                    }
                    if (!(2 & e.flags)) return e.stateNode
                }
            }
Flags: needinfo?(jdemooij)

Jan, is the uA function manipulating DOM elements? Maybe this bug is a hint to look at DOM field access.

Severity: -- → N/A
Priority: -- → P2

Looking at the profile, we're spending 97% of our time in uA itself, not in anything it calls. So I think it's unlikely that it's touching DOM elements.

Not sure what changed, but this takes 2s on nightly: https://share.firefox.dev/41sgUwV .
Chrome takes 300ms, but now the hotspots are in editor/Focus/Mutation thingies, for which numerous bugs already exist.
CAlling this WFM.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → WORKSFORME

Looks like the webpage was rewritten; the script containing the slow uA function (https://quilljs.com/_next/static/chunks/framework-98741467467a0898.js) doesn't show up anywhere in the latest profile.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: