Closed Bug 1877124 Opened 1 year ago Closed 1 year ago

Reduce memory use of SortedArenaList

Categories

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

task

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox124 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 1 open bug)

Details

(Keywords: perf-alert)

Attachments

(8 files)

This takes 4072 bytes and is only used during incremental foreground sweeping. This is nearly 40% of the size of GCRuntime.

Severity: -- → N/A
Priority: -- → P3

Most uses of this are from the GC when there will not be any foreground
finalized arenas to iterate.

Currently we link the foreground finalized arenas in the sorted arena list into
a single list when we yield to the mutator during foreground finalization.
Iteration is only required for the debugger and memory reporting APIs so it
makes sense to skip this until it's actually needed. This also centralises the
state of which zone/kind we are finalizing in the GCRuntime rather than storing
it in each zone.

We have to copy out the tail pointer for each list segment in the sorted arena
list when converting it to a single list so we can restore it later.

This reduces size of SortedArenaList (used in GCRuntime) from 4072 to 2040 bytes.

I don't know why this had a separate constant for the same value, but we can
move MinCellSize into HeapAPI.h and use it here.

This implements putting arenas into N bins using N/2 lists by inserting either
at the front of the back of a list as necessary.

This further reduces the size of SortedArenaList to 1032 bytes.

Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5d252ab19fe3 Part 1: Add a template for a circular singly linked list r=sfink https://hg.mozilla.org/integration/autoland/rev/859d7297fe2f Part 2: Split off an arena iter that is only used by the GC r=sfink https://hg.mozilla.org/integration/autoland/rev/3e7f6daeeaab Part 3: Lazily link foreground finalized arenas only when needed by iteration r=sfink https://hg.mozilla.org/integration/autoland/rev/b191fc95b97f Part 4: Repalace use of SortedArenaListSegment with SinglyLinkedList in SortedArrayList r=sfink https://hg.mozilla.org/integration/autoland/rev/8163c091644a Part 5: Use MinCellSize constant in SortedArenaList r=sfink https://hg.mozilla.org/integration/autoland/rev/3a5a8d217d70 Part 5.5: Pass alloc kind into SortedArenaLists to simplify debug checks r=sfink https://hg.mozilla.org/integration/autoland/rev/6138042213fd Part 6: Make use of the fact that lists have two ends to halve the number of lists in SortedArenaList r=sfink https://hg.mozilla.org/integration/autoland/rev/7d03e4900bb3 Part 7: Rename SortedArenaList segments to buckets r=sfink
Regressions: 1880258
Regressions: 1880171
Regressions: 1880444

(In reply to Pulsebot from comment #9)

Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5d252ab19fe3
Part 1: Add a template for a circular singly linked list r=sfink
https://hg.mozilla.org/integration/autoland/rev/859d7297fe2f
Part 2: Split off an arena iter that is only used by the GC r=sfink
https://hg.mozilla.org/integration/autoland/rev/3e7f6daeeaab
Part 3: Lazily link foreground finalized arenas only when needed by
iteration r=sfink
https://hg.mozilla.org/integration/autoland/rev/b191fc95b97f
Part 4: Repalace use of SortedArenaListSegment with SinglyLinkedList in
SortedArrayList r=sfink
https://hg.mozilla.org/integration/autoland/rev/8163c091644a
Part 5: Use MinCellSize constant in SortedArenaList r=sfink
https://hg.mozilla.org/integration/autoland/rev/3a5a8d217d70
Part 5.5: Pass alloc kind into SortedArenaLists to simplify debug checks
r=sfink
https://hg.mozilla.org/integration/autoland/rev/6138042213fd
Part 6: Make use of the fact that lists have two ends to halve the number of
lists in SortedArenaList r=sfink
https://hg.mozilla.org/integration/autoland/rev/7d03e4900bb3
Part 7: Rename SortedArenaList segments to buckets r=sfink

== Change summary for alert #41531 (as of Wed, 21 Feb 2024 10:50:43 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
0.27% Base Content JS linux1804-64-shippable-qr fission 1,505,428.67 -> 1,501,410.67
0.27% Base Content JS macosx1015-64-shippable-qr fission 1,506,344.00 -> 1,502,210.67
0.27% Base Content JS macosx1015-64-shippable-qr fission 1,506,344.00 -> 1,502,248.00

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=41531

Keywords: perf-alert
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: