Closed Bug 1923636 Opened 2 years ago Closed 2 years ago

Slightly modified Codepen demo is 10x slower with GPU-canvas/D2d-canvas compared to Chrome. (Time spent in PathOps and memcpy)

Categories

(Core :: Graphics: Canvas2D, defect)

defect

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox-esr128 --- wontfix
firefox131 --- wontfix
firefox132 --- wontfix
firefox133 --- fixed

People

(Reporter: mayankleoboy1, Assigned: lsalzman, NeedInfo)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files, 1 external file)

Attached file about:support —
Keywords: regression
Regressed by: 1839470

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

:jrmuizel, since you are the author of the regressor, bug 1839470, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(jmuizelaar)

Tentatively triaging as S2, but escalating to gfx-triage for confirmation.

Severity: -- → S2
Severity: S2 → S3

TransformedCopyToBuilder is called any time in Canvas2D the transform
is modified and then a path op is used. On cases that repeatedly change
the transform while building paths, this leads to fairly significant
expense in repeatedly copying the path contents as well as allocating
and deallocating paths.

To work around this, a new primitive TransformedMoveToBuilder is provided
that allows in-place transforming of the path contents. Because paths that
are "finished" and referenced externally can't be safely modified, extra
static methods (i.e. ToBuilder) are added to guarantee that there are no
other refs to the path before modifying its contents.

One snag is that ArcParams could previously not handle transforms, so it
is modified to allow a transform to be supplied to an Arc op, which is
only flattened out when it is streamed to a sink.

Assignee: nobody → lsalzman
Status: NEW → ASSIGNED
Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cb3d8312e42e Avoid copying paths when transforming. r=aosmond
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch

Profile with latest Nightly:

AC2D: https://share.firefox.dev/4eWZjSc (6.5s)
skia-canvas: https://share.firefox.dev/4f7J6JB (1.7s)
Chrome: https://share.firefox.dev/4dJdQjj (3.6s)

We improved massively, but are 2x slower than Chrome and 4x slower than Skia-canvas here. Worth filing a new bug?

(In reply to Mayank Bansal from comment #8)

Profile with latest Nightly:

AC2D: https://share.firefox.dev/4eWZjSc (6.5s)
skia-canvas: https://share.firefox.dev/4f7J6JB (1.7s)
Chrome: https://share.firefox.dev/4dJdQjj (3.6s)

We improved massively, but are 2x slower than Chrome and 4x slower than Skia-canvas here. Worth filing a new bug?

I am okay with where we are at currently now that I optimized this, so I don't imagine I will be doing much further work on this unless this turns out to be an obnoxious bottleneck in the wild outside of demos. The way we track transforms in Canvas2D has some pros and cons vs Chrome, and there aren't too many ways to optimize this more than I have, I think.

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

Attachment

General

Creator:
Created:
Updated:
Size: