Skip to content
Unverified Commit f239abac authored by Alexandru Gheorghe's avatar Alexandru Gheorghe Committed by GitHub
Browse files

approval-distribution: Fix preallocation of ApprovalEntries (#5411)



We preallocated the approvals field in the ApprovalEntry by up to a
factor of two in the worse conditions, since we can't have more than 6
approvals and candidates.len() will return 20 if you have just the 20th
bit set.
This adds to a lot of wasted memory because we have an ApprovalEntry for
each assignment we received

This was discovered while running rust jemalloc-profiling with the steps
from here: https://www.magiroux.com/rust-jemalloc-profiling/

Just with this optimisation approvals subsystem-benchmark memory usage
on the worst case scenario is reduced from 6.1GiB to 2.4 GiB, even cpu
usage of approval-distribution decreases by 4-5%.

---------

Signed-off-by: default avatarAlexandru Gheorghe <[email protected]>
parent 37c20272
Pipeline #491454 waiting for manual action with stages
in 1 hour, 31 minutes, and 2 seconds