Vec allocation time is too high in WGR::PathBuilder
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox121 | --- | fixed |
People
(Reporter: jnicol, Assigned: jnicol)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sp3])
Attachments
(2 files)
GenerateQuantizedPath()
shows up in profiles of Charts-chartjs: https://share.firefox.dev/48T9STP (and Perf-Dashboard too)
This is mostly caused by reallocs when push()
ing items in to the points and types vectors, eg in curve_to()
. Then much less significantly in get_path()
calling Vec::into_boxed_slice()
causes the vectors' storages to be realloced to the exact size.
If we allocate a single PathBuilder
in DrawTargetWebgl::SharedContext
and reset it between uses, whilst persisting the Vec storage, then we can effectively reduce this just to allocating the Boxed slices in PathBuilder::get_path()
Unfortunately this doesn't translate to a win in the test overall, as the improvements it leads to in the sync portions are undone by an increased wait in ClientWebGLContext::GetFrontBuffer()
in the async step. See profile. Which is unfortunate, but this still seems worthwhile fixing anyway.
Assignee | ||
Comment 1•2 years ago
|
||
We could go even further and provide nsTArray
/thin_vec
s from the gecko side, only needing additional allocs/copies when there is a cache miss in PathCache::FindOrInsertEntry
. But given this will need invasive API changes and the gains will be eaten up by the sync texture wait anyway, I don't think that's a good idea.
Assignee | ||
Comment 2•2 years ago
|
||
DO NOT LAND: Change back to FirefoxGraphics repo after
https://github.com/FirefoxGraphics/wpf-gpu-raster/pull/2 has been
merged
Assignee | ||
Comment 3•2 years ago
|
||
This avoids some expensive vector reallocations.
Depends on D191282
Updated•2 years ago
|
Updated•2 years ago
|
Comment 5•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/92dd9aca656c
https://hg.mozilla.org/mozilla-central/rev/da6a29fc726b
https://hg.mozilla.org/mozilla-central/rev/baf6a4468415
Description
•