Closed Bug 1509226 Opened 6 years ago Closed 6 years ago

Avoid allocations to define clips

Categories

(Core :: Graphics: WebRender, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: mattwoodrow, Assigned: mattwoodrow)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Both versions of DefineClipChain use an nsTArray to collect the clips to be defined, which means at least 2 allocations for every new clip we encounter.

The two types (wr::WrClipId and size_t) are the same thing in-memory, so we should be able to use a single vector, and AutoTArray should stop us from allocating in all but the most extreme cases.

Doing this removes a few % from WR command building time.
I filed something like this in bug 1506172.
Uploading my patch anyway, since it's done.

I think we could land it now, and do the conversion to the properly exported rust type in 1506172 once the clip cleanup is done. Or we could just wait, it's not a huge performance difference. I don't mind.
MozReview-Commit-ID: CetmS5cZCMP

Depends on D12720
I'd rather use the same WrClipId in both places instead of asserting that size_t is the same type.
Depends on: 1509554
Pushed by mwoodrow@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d6509279d52e
Avoid allocations to serialize clips. r=jrmuizel
https://hg.mozilla.org/mozilla-central/rev/d6509279d52e
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
No longer blocks: 1422039
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: