perf(profiling): use an arena-based string table #2511
Closed
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
This updates libdatadog to use a branch which has an arena-based string table. See DataDog/libdatadog#306.
The arena capacity probably needs some tweaking, and should probably be set to a specific target set by the team after careful consideration. The memory is lazily populated by the OS, at least, so it's not automatically used (asking for 512 MiB won't allocate all 512 MiB immediately, it will grow up to that limit and then stop).
Part of PROF-9123.
Overhead
Using the symfony/demo with PHP 8.3 using php-fpm, this netted me about 3-4% less total container memory. I expected there to be a difference because:
u16
, so we save a few bytes per string compared to ausize
.I'm happy with 3-4% off the container, and don't feel a need to try to specifically calculate the reduction of just libdatadog's memory.
I haven't attempted to measure CPU rigorously. Unscientifically, it looks on par with master. I would expect a very slight win with this PR because arena allocators are quick to allocate, and we can skip deallocation altogether (but deallocation is infrequent, roughly once per minute). Since eyeballing it looks on-par with master, which was the expectation, I won't dive into it deeper.
Reviewer checklist