Open holiman opened 5 days ago
Can you measure the reduction in memory allocations achieved by applying this change? Please evaluate its impact during both snap sync and full sync.
This pull request introduces optimizations to reuse the buffer for keying. These changes are only meaningful if they result in a obvious reduction in memory allocations.
This came from an alloc dump on a running sync (mingeth).
Quite a lot of
bytes
are allocated temporarily when we write to db (batches), in order to construct the keys. These allocs are very shortlived, since the write-operations are not allowed to hold on to the keys, but instead copies it to some interrnal buffers.This PR changes some of the most heavy mass-write-locations to reuse a key buffer. The locations are for example writing accounts received over snapsync, storage received over snapsync and merging in-memory snapshot-changes to disk.
Not sure how large effect this has. I suspect not a whole lot, but I'll run a benchmark sync and see if it anything is discernable.
Not high prio