Skip to content

bench(profiling): measure live heap tracking paths#4045

Draft
realFlowControl wants to merge 3 commits into
masterfrom
florian/no-jira-heap-live-tracking-benchmark
Draft

bench(profiling): measure live heap tracking paths#4045
realFlowControl wants to merge 3 commits into
masterfrom
florian/no-jira-heap-live-tracking-benchmark

Conversation

@realFlowControl

@realFlowControl realFlowControl commented Jul 17, 2026

Copy link
Copy Markdown
Member

Description

This PR extracts the existing heap-live map and count into LiveHeapTracker<T> and routes the existing thread-local allocation state through LocalLiveHeapTracker without changing behavior. The Criterion benchmark compiles and calls these production track and untrack methods directly, without linking a PHP executable.

The fixture keeps 2,048 32-byte samples in the tracker and rotates eight-byte-aligned target addresses through the same application pages. It times batches of 256 production calls so fixture mutation and per-operation timer overhead are excluded. The three measured paths are adding a tracked allocation, freeing a tracked allocation, and freeing an untracked allocation.

Run it with cargo bench -p datadog-php-profiling --bench heap_live_tracking.

DashMap-only baseline on an Apple M4 Max:

  • allocate_tracked: 5.484–5.504 ns
  • free_tracked: 5.512–5.539 ns
  • free_untracked: 2.634–2.651 ns

Validation performed: profiler Rust unit tests passed (22 tests), profiler clippy passed with the unrelated pre-existing got_macho.rs lint suppressed, and the benchmark completed successfully.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@realFlowControl realFlowControl added the profiling Relates to the Continuous Profiler label Jul 17, 2026
@realFlowControl
realFlowControl force-pushed the florian/no-jira-heap-live-tracking-benchmark branch from e954bcf to b13f0d3 Compare July 17, 2026 10:48
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jul 17, 2026

Copy link
Copy Markdown

Pipelines  Tests

Unblock PR with BitsAI

⚠️ Warnings

🚦 13 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-php | clippy NTS: [7.1]   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-php | clippy NTS: [7.2]   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-php | clippy NTS: [7.3]   View in Datadog   GitLab

View all 13 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 54.07% (-0.05%)

Useful? React with 👍 / 👎

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

@pr-commenter

pr-commenter Bot commented Jul 17, 2026

Copy link
Copy Markdown

Benchmarks [ profiler ]

Benchmark execution time: 2026-07-17 11:16:44

Comparing candidate commit 9a0cf90 in PR branch florian/no-jira-heap-live-tracking-benchmark with baseline commit 17a0855 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 28 metrics, 8 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 ----------------------------------'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

profiling Relates to the Continuous Profiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant