perf(profiling): allocate 512 capacity initially for alloc map#18119
Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits intoMay 18, 2026
Merged
Conversation
Codeowners resolved as |
9d7d459 to
cc01596
Compare
Contributor
🎉 All green!❄️ No new flaky tests detected 🔗 Commit SHA: 2242e8c | Docs | Datadog PR Page | Give us feedback! |
taegyunkim
reviewed
May 15, 2026
66ceb57 to
ebbfc0f
Compare
KowalskiThomas
approved these changes
May 17, 2026
Contributor
KowalskiThomas
left a comment
There was a problem hiding this comment.
I have nothing against this but FWIW I've never seen rehashes show up in profiles so it's probably not going to change much.
Co-authored-by: Thomas Kowalski <thomas.kowalski@datadoghq.com>
57aadce to
04be43f
Compare
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.

Description
flat_hash_map rehashes at 87.5% load (https://abseil.io/docs/cpp/guides/container#hash-tables) doubling capacity each time. Without this, growing from 0 to 1024 entries triggers ~8 rehashes:
capacity: 4 -> 8 -> 16 -> 32 -> 64 -> 128 -> 256 -> 512 -> 1024
rehash at: 4 7 14 28 56 112 224 448
p99 live heap count is ~350
Each rehash at capacity N copies all N existing entries.
This only minorly improves startup, but this is a cheap non-negative change
Testing
Risks
Additional Notes