Improve buffer allocator performance with frequent nursery collections
Categories
(Core :: JavaScript: GC, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox143 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
References
(Blocks 1 open bug)
Details
Attachments
(6 external files)
Bug 1973033 causes a small performance regression for the typescript benchmark. Investigating this shows that it can slow down nursery collections and in benchmarks with many nursery collections this can become significant.
The root cause is that on minor GC the buffer allocator currently removes all free regions in chunks containing nursery allocations from the table of free regions it allocates out of, so that the chunks containing them can be swept. This can become significant if there are many such free regions.
The plan is to avoid this by separating free regions that have been recently allocated out of from the set of all known free regions, thus reducing the number of regions that need to be traversed on minor GC.
Updated•1 year ago
|
| Assignee | ||
Comment 1•1 year ago
|
||
Currently free regions live in the central BufferAllocator::freeLists. This
change allows individual chunks to optionally own their own free regions. This
will be used to hold their free regions after they have been swept but before
the regions are mreged into the main freeLists.
| Assignee | ||
Comment 2•1 year ago
|
||
Currently there are two chunk lists, |mixedChunks| and |tenuredChunks| that
hold all chunks not currently being swept. Currently all free regions are held
in the central |BufferAllocator::freeLists|. On sweeping this is cleared and
rebuilt.
This change adds |availableMixedChunks| and |availableTenuredChunks|. Chunks in
these lists own their own free regions. These are merged into |freeLists| as
needed.
To prepare for sweeping a chunk we either move free regions in that chunk from the central
|freeLists| to the chunk's |freeLists| for tenured chunks, or just remove them
from |freeLists|. On sweep free lists are rebuild and stored in the chunk's
|freeLists| (a future possible option is to skip this if we notice that nothing
has died in the chunk). When a chunk is selected for allocation the contents of
its |freeLists| are moved to the central one and allocation proceeds as normal.
The benefit of all this is to reduce the number of regions in the main
freeLists, which has to be traversed on minor collection.
| Assignee | ||
Comment 3•1 year ago
|
||
Similar to FreeLists, these will store lists of chunks binned by the size of their
largest free region. These will be used to efficiently find an availble chunk
to start allocating out of.
| Assignee | ||
Comment 4•1 year ago
|
||
| Assignee | ||
Comment 5•1 year ago
|
||
This aims to increase the frequency of the fast path hitting and to make us
more likely to reuse free space in existing chunks before allocting new chunks.
| Assignee | ||
Comment 6•1 year ago
|
||
This adds the appropriate iterators that make use of |available| rather than
iterating every list.
https://hg.mozilla.org/mozilla-central/rev/68eac295b0a4
https://hg.mozilla.org/mozilla-central/rev/72ad5e271209
https://hg.mozilla.org/mozilla-central/rev/cacc9835d03c
https://hg.mozilla.org/mozilla-central/rev/c1341b7d7416
https://hg.mozilla.org/mozilla-central/rev/6393d680cb06
https://hg.mozilla.org/mozilla-central/rev/2864db012879
Description
•