Closed Bug 1804340 Opened 2 years ago Closed 2 years ago

Reduce realloc overhead in wpf-gpu-raster

Categories

(Core :: Graphics: Canvas2D, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: lsalzman, Assigned: lsalzman)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

We spend a substantial amount of time in wpf-gpu-raster (and also aa-stroke sometimes) reallocing/shrinking the vertex buffer. This can show as up to 10% of release profiles. Additionally, we spend a lot of time memmove-ing out of this buffer into shared memory, but that is probably best dealt with in a follow-up. However, the changes in this bug will at least lay some groundwork for further optimizing the shared memory situation later.

Example demos -
https://js1k.com/2013-spring/demo/1390
https://codepen.io/DonKarlssonSan/pen/KKoaRrY

This adds machinery to wpf-gpu-raster and aa-stroke to support an output buffer specified as
a slice, which they will preferentially use instead of their dynamic Vec to store output
vertexes in.

This pre-allocates a vertex output buffer in DrawTargetWebgl so that we can generate
wpf-gpu-raster and aa-stroke output into it. This way, they don't have to realloc
a Vec for pushes or changing into a boxed slice. This can net 5-10% on profiles for
the demos noted in the bug.

Depends on D163989

Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/24d7f14d347c Update wpf-gpu-raster and aa-stroke to support generating into a slice. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/99052dd249cc Generate path vertexes into pre-allocated output buffer. r=jrmuizel
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: