-
Notifications
You must be signed in to change notification settings - Fork 15
feat(profiling-ffi): ProfileDictionary + ddog_prof_Profile_add2 #1393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d83b00c to
60fdb91
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1393 +/- ##
==========================================
- Coverage 71.16% 70.88% -0.29%
==========================================
Files 403 410 +7
Lines 64368 64919 +551
==========================================
+ Hits 45810 46018 +208
- Misses 18558 18901 +343
🚀 New features to boost your workflow:
|
BenchmarksComparisonBenchmark execution time: 2025-12-13 00:38:09 Comparing candidate commit 7b0e46d in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 57 metrics, 2 unstable metrics. CandidateCandidate benchmark detailsGroup 1
Group 2
Group 3
Group 4
Group 5
Group 6
Group 7
Group 8
Group 9
Group 10
Group 11
Group 12
Group 13
Group 14
Group 15
Group 16
Group 17
Group 18
Group 19
BaselineOmitted due to size. |
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-apple-darwin
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-apple-darwin
x86_64-unknown-linux-gnu
|
What does this PR do?
Adds these FFI functions:
ddog_prof_ProfilesDictionary_newddog_prof_ProfilesDictionary_try_cloneddog_prof_ProfilesDictionary_insert_functionddog_prof_ProfilesDictionary_insert_mappingddog_prof_ProfilesDictionary_insert_strddog_prof_ProfilesDictionary_get_strddog_prof_ProfilesDictionary_dropddog_prof_Profile_with_dictionaryddog_prof_Profile_add2And these helper types:
ArcHandleProfileErrorProfileStatusMotivation
These functions allow FFI for long-lived data. Profilers like .NET can cache a
FunctionId2object rather than caching various strings, which they then have to copy into queues. So they go from 2+ string copies, to holding an integer, much better. Python also showed improvement with an experimental version.Additional Notes
Benchmarking the profiles.c example on macOS, the performance is roughly 50/50 split in the old and new API. This makes sense because the new API internally translates to the old API. The data shows that translating costs about 31% of the time, which gives us an idea of how much it might be improved if we remove the translation and directly work with the profiles dictionary internally too.
How to test the change?
Describe here in detail how the change can be validated.