feat(malloc_utils): add mimalloc and tcmalloc allocator feature flags#8884
Open
0xMars42 wants to merge 1 commit intosigp:unstablefrom
Open
feat(malloc_utils): add mimalloc and tcmalloc allocator feature flags#88840xMars42 wants to merge 1 commit intosigp:unstablefrom
0xMars42 wants to merge 1 commit intosigp:unstablefrom
Conversation
Add feature flags for mimalloc and tcmalloc as alternatives to jemalloc, which has been deprecated upstream. Both allocators override jemalloc via cfg guards, matching the existing sysmalloc override pattern. Allocator metrics are stubbed for now and can be fleshed out in a follow-up once a preferred allocator is chosen. Usage: cargo build -p lighthouse --features mimalloc cargo build -p lighthouse --features tcmalloc Closes sigp#8840
962bbcd to
c8da760
Compare
Member
|
Please familiarise yourself with our policy regarding AI contributions (currently in review but likely to be merged very soon): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8840
Adds
mimallocandtcmallocfeature flags tomalloc_utils,lighthouse, andlclicrates.Usage
mimalloc/tcmalloc override jemalloc via cfg guards (same pattern as
sysmalloc), so--no-default-featuresis not needed despite jemalloc being hardcoded in the binary deps.Both features are unix-only enabling them on Windows produces a compile_error. Enabling both simultaneously also produces a compile_error.
Benchmarks
lcli transition-blockson a recent mainnet finalized block (10 runs,--exclude-cache-builds --exclude-post-block-thc):jemalloc and mimalloc are effectively identical on block processing. tcmalloc is ~6% slower. These numbers only cover
transition-blocksthough live node testing with sustained load and varying allocation patterns could show different results.Changes
common/malloc_utils/Cargo.tomladd mimalloc + tcmalloc optional deps and featurescommon/malloc_utils/src/lib.rsconditional compilation for new allocators, compile_error guards for invalid combinationscommon/malloc_utils/src/mimalloc_alloc.rsnew#[global_allocator]modulecommon/malloc_utils/src/tcmalloc_alloc.rsnew#[global_allocator]modulelighthouse/Cargo.tomlexpose mimalloc/tcmalloc featureslcli/Cargo.tomlexpose mimalloc/tcmalloc featuresAllocator metrics for mimalloc/tcmalloc are stubbed out can be filled in as a follow-up once we decide which allocator to invest in.