ChainSafe / ChainSafe/forest

Re-consider MiMalloc as the default allocator

Open
#7,393 0 comments 0 reactions 0 assignees View on GitHub
Type: Task
Dominant language
Rust
Stars
697
Forks
200
Avg merge
1d 5h
Merged PRs (30d)
65

Description

# Summary

Back in the ancient days we considered different allocators https://github.com/ChainSafe/forest/issues/2523

`jemalloc` eventually won thanks to slightly smaller peak RSS during a snapshot import to ParityDb (which we don't really do anymore that much thanks to CarDB). Now, the benchmarks presented at this [talk at EuroRust 2024](https://youtu.be/pJ-FRRB5E84?si=nEb5D_AjCQVjen8b&t=1529) suggest that `mimalloc` should _theoretically_ outperform `jemalloc`. Practically this need to be measured on our use case to make an informed decision.

To make the switch we need a compelling reason from some numbers. Things to compare:
- compilation time - @hanabi1224 reported `mimalloc` compilation is/was faster than `jemalloc`'s. To be measured.
- performance tests (time and peak RSS) - we have some existing benchmarks we could use to compare the performance, perhaps some parallel state computation, calling A LOT of RPC methods. We don't really have a strict suite here so use your best judgement.

Note that eventual switch to `mimalloc` as default doesn't mean we should get rid of `jemalloc` completely - the latter has excellent profiling features.

# Completion Criteria

- [ ] run and present benchmarks in a table
- [ ] if `mimalloc` proves to be consistently faster in our tested use-cases, make the switch.

# Additional Links & Resources

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.