CanvasRenderingContext2D::BeginPath() show up in Speedometer 3 canvas (Charts-chartjs, Performance-Dashboard) profiles
Categories
(Core :: Graphics: Canvas2D, defect, P2)
Tracking
()
People
(Reporter: smaug, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sp3])
Looks like at least mPath = nullptr; is causing quite a bit allocator traffic.
Could we reuse some of the objects?
https://searchfox.org/mozilla-central/rev/2ede53e39955988f98db4369f7ce09614b22104a/dom/canvas/CanvasRenderingContext2D.cpp#2842-2843
I used https://speedometer-preview.netlify.app/interactiverunner for running the test, and it is ZoomTheChart-sync part where the BeginPath shows up.
Comment 1•2 years ago
|
||
Jeff, would this be at all impacting SP3?
Reporter | ||
Comment 2•2 years ago
|
||
This is all about sp3 ;) React-Stockcharts is part of that.
Comment 3•2 years ago
|
||
Can you include a link to the profile? Path objects are immutable so reuse is not so easy or pleasant.
Updated•2 years ago
|
Updated•2 years ago
|
Reporter | ||
Comment 4•2 years ago
|
||
https://share.firefox.dev/3YTzPN0
That is on Windows.
Comment 5•2 years ago
|
||
PathRecording currently keeps two copies of the Path data: mPathOps
and mPath
. mPath is used for implementing ContainsPoint()
, StrokeContainsPoint()
, GetBounds()
and GetStrokedBounds()
however we rarely use these methods. It's probably reasonable to make conversion to mPath
on demand instead of eager. That would make recording cheaper and reduce the amount of time spent freeing. It should also help SVG blob performance.
Comment 6•2 years ago
|
||
Olli, can you get a new profile now that bug 1447839 has landed?
Reporter | ||
Comment 7•2 years ago
|
||
It is better, but still quite (de)allocation heavy: https://share.firefox.dev/400eB1m
Without looking at the code, just the profile:
Would it make sense to not use std::vector, but AutoTArray?
I see also std::unordered_set. Is that possibly more allocator heavy than the hashtables we normally use?
Comment 8•2 years ago
|
||
This also shows up on the Charts-chartjs and Perf-Dashboard subtests. Fixing the performance difference with Chrome would improve Firefox's score on these subtests by 0.9% and 0.5% respectively.
Firefox: https://share.firefox.dev/44EoIv0
Chrome: https://share.firefox.dev/3Y5OOV8
Description
•