Skip to content

chore(profiling): clean up code and update Rust dependencies#4038

Merged
realFlowControl merged 23 commits into
masterfrom
florian/cleanup
Jul 10, 2026
Merged

chore(profiling): clean up code and update Rust dependencies#4038
realFlowControl merged 23 commits into
masterfrom
florian/cleanup

Conversation

@realFlowControl

@realFlowControl realFlowControl commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

This PR cleans up the profiler implementation and updates its direct Rust dependencies. It removes unused code and dependencies, reduces repeated test and build-script plumbing, and updates dependencies in focused commits.

The main runtime improvements are the upgrade to rustc-hash 2.1.3, which provides a faster and better-finalized hash algorithm with improved string hashing for stack interning, live heap tracking, and the I/O file descriptor cache, and the upgrade to rand 0.9.4 plus rand_distr 0.5.1, which uses the rewritten large-lambda Poisson sampler. In a local two-million-sample release benchmark, Poisson sampling improved from 121.44 ns to 33.23 ns at lambda 100 and from approximately 114 ns to 22 ns at the I/O and allocation lambdas, a 3.7–5.3x speedup. The Poisson state grows by 48 bytes per sampler, approximately 480 bytes per PHP thread (1 for NTS, n for ZTS).

The dynasmrt 5.0.0 update also picks up internal AArch64 instruction-cache handling and an upstream fix for an illegal-instruction crash on Apple AArch64, directly covering the generated PHP frameless-call trampolines.

Remaining updates are maintenance and compatibility upgrades; Criterion and UUID are intentionally unchanged because their latest versions would respectively conflict with criterion-perf-events and add another getrandom generation without improving profiler code.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

rustc-hash 2 uses a faster, better-finalized hashing algorithm with significantly improved string hashing. This benefits stack string interning, the live heap tracker, and the I/O file descriptor cache without increasing their stored state.

Use the crate's FxBuildHasher and FxHashSet aliases instead of local BuildHasherDefault plumbing.
Upgrade rand to 0.9.4 and rand_distr to 0.5.1 together so the profiler uses rand_distr's rewritten large-lambda Poisson sampler.

A local two-million-sample release benchmark improved sampling from 121.44 to 33.23 ns at lambda 100 and from roughly 114 to 22 ns at the I/O and allocation lambdas, a 3.7-5.3x speedup. The new sampler also fixes statistical inaccuracies for large lambda values.

The tradeoff is that Poisson<f64> grows from 40 to 88 bytes, adding about 432 bytes per NTS PHP thread plus 48 process-wide, or 480 bytes per ZTS thread.
Newer dynasmrt releases handle AArch64 instruction-cache invalidation internally and include a fix for an illegal-instruction crash on Apple AArch64. This directly covers the runtime-generated PHP frameless-call trampolines.

Adopt the current .i64 data directive required by dynasm 5. The all-features unit tests pass and a release-built extension successfully executes an internal PHP function through the frameless runtime path.
Pick up newer FFI generation fixes, including safer opaque type layouts, current Rust syntax generation, and compatibility with newer Clang releases. The existing preserve_none opcode-handler workaround remains necessary.
Use bindings synchronized with current Apple 26.1 headers. The profiler's Rust 1.87 toolchain supports mach2's 2024 edition, so the previous edition-based version restriction is no longer needed.
Take the maintained DashMap 6 release and its current synchronization dependencies. This is a maintenance update; no profiler-level performance improvement is claimed without a live heap tracking benchmark.
Update the regex engine and syntax crates required by env_logger 0.11.11.
Update env_filter and log to the versions required by the current env_logger patch release.
@realFlowControl realFlowControl added profiling Relates to the Continuous Profiler dependencies Pull requests that update a dependency file labels Jul 10, 2026
@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Jul 10, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 42 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-php | test_web_custom: [8.0, fpm-fcgi]   View in Datadog   GitLab

🧪 1 Test failed

All test failures are known flaky.

❄️ Known flaky: testInstrumentation from custom-framework-autoloading-test.DDTrace\Tests\Integrations\Custom\Autoloaded\InstrumentationTest   View in Datadog
DDTrace\Tests\Integrations\Custom\Autoloaded\InstrumentationTest::testInstrumentation
Failed asserting that an array has the key &#39;logs_created&#39;.

tests/Integrations/Custom/Autoloaded/InstrumentationTest.php:80
tests/Common/RetryTraitVersionGeneric.php:28

Not introduced in this PR.

DataDog/apm-reliability/dd-trace-php | ASAN test_c with multiple observers: [8.3]   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-php | test_extension_ci: [8.4]   View in Datadog   GitLab

View all 42 failed jobs.

3 Test performance regressions detected

testUserSignUp from symfony-52-test.DDTrace\Tests\Integrations\Symfony\V5_2\AutomatedLoginEventsTest — 8.02s (+7.47s, +1360%)   View in Datadog

testLoggedInCalls from symfony-52-test.DDTrace\Tests\Integrations\Symfony\V5_2\AutomatedLoginEventsTest — 1m 2.39s (+59.92s, +2419%)   View in Datadog

testLoggedInCalls from laravel-8x-test.DDTrace\Tests\Integrations\Laravel\V8_x\AutomatedLoginEventsTest — 11.8s (+11.11s, +1615%)   View in Datadog

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 54.08% (-0.04%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: f3f0c29 | Docs | Datadog PR Page | Give us feedback!

@pr-commenter

pr-commenter Bot commented Jul 10, 2026

Copy link
Copy Markdown

Benchmarks [ profiler ]

Benchmark execution time: 2026-07-10 11:35:52

Comparing candidate commit f3f0c29 in PR branch florian/cleanup with baseline commit 50a327e in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 27 metrics, 9 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

@realFlowControl
realFlowControl marked this pull request as ready for review July 10, 2026 12:24
@realFlowControl
realFlowControl requested review from a team as code owners July 10, 2026 12:24
@realFlowControl
realFlowControl requested a review from a team as a code owner July 10, 2026 12:24

@bwoebi bwoebi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup. I like the merging of zts+debug checks :-D

@realFlowControl
realFlowControl merged commit 268dcfb into master Jul 10, 2026
2116 of 2159 checks passed
@realFlowControl
realFlowControl deleted the florian/cleanup branch July 10, 2026 14:12
@realFlowControl realFlowControl added this to the 1.23.0 milestone Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file profiling Relates to the Continuous Profiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants