Closed Bug 1881019 Opened 1 year ago Closed 1 year ago

Optimize branches in TenuringTracer::traverse

Categories

(Core :: JavaScript: GC, task, P2)

task

Tracking

()

RESOLVED FIXED
125 Branch
Tracking Status
firefox125 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(3 files)

This function is very hot during nursery collections because it's used to trace object slots/elements. It has branches to check for object/string/bigint values, but in practice about 50% of the values we see there aren't GC things and it would be nice to reduce the number of branches in this case.

We could check isGCThing() first to 'discard' about 48% of all values because they aren't gc things. After that we can check if the cell is tenured, this gets rid of another ~25% of values. That leaves about 27% of nursery-allocated values.

A Speedometer 3 comparison of just this change shows a number of medium/high confidence 1-2% improvements on a number of sub tests.

https://treeherder.mozilla.org/perfherder/comparesubtest?originalProject=try&newProject=try&newRevision=0eae5ffd806a5fa22d393fb49684fee30673fb2c&originalSignature=4586009&newSignature=4586009&framework=13&application=firefox&originalRevision=827fe39e928d1a7b6cf118f335d8c46d85a81a22&page=1

On Speedometer 3, about 48% of the values aren't GC things so check for
this first. Of the remaining values, about 47% are tenured so check for that
next.

This reduces the number of branches we have to take and improves some Speedometer 3
sub tests by a few percent.

Checking is-native upfront lets us avoid checking for the 3 non-native object types
for native objects not special-cased there. Similarly this also reduces the number of
branches for non-native objects.

isForwarded() is true in about 45% of cases.

Priority: -- → P2
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1193e9ba23df part 1 - Optimize TenuringTracer::traverse a bit. r=jonco https://hg.mozilla.org/integration/autoland/rev/2645007f875c part 2 - Reduce number of cases to check for in JSObject::allocKindForTenure. r=jonco https://hg.mozilla.org/integration/autoland/rev/d75a5d616386 part 3 - Hoist isForwarded check in TenuringTracer::traverse. r=jonco
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch
See Also: → 1900724
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: