Skip to content

Avoid instrumenting c++ allocators when they call malloc internally#458

Merged
nsavoire merged 1 commit into
mainfrom
nsavoire/cxx_allocators_instrumentation
Oct 28, 2025
Merged

Avoid instrumenting c++ allocators when they call malloc internally#458
nsavoire merged 1 commit into
mainfrom
nsavoire/cxx_allocators_instrumentation

Conversation

@nsavoire

Copy link
Copy Markdown
Collaborator

What does this PR do?

When malloc and new are defined in 2 different libraries then new most likely calls malloc, and therefore c++ allocators do not need to be instrumented.
This improves performance by avoiding unnecessary allocation calls interception:
eg. libstdc++ operator new[](unsigned long) calls operator new(unsigned long), which calls malloc
hence without this change we would intercept this allocation at 3 different points.

@nsavoire
nsavoire requested a review from r1viollet as a code owner October 28, 2025 11:40
@pr-commenter

pr-commenter Bot commented Oct 28, 2025

Copy link
Copy Markdown

Benchmark results for collatz

Parameters

Baseline Candidate
config baseline candidate
profiler-version ddprof 0.21.0+205b2320.80056045 ddprof 0.21.0+a922cfd1.80474070

Summary

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

See unchanged results
scenario Δ mean execution_time
scenario:ddprof -S bench-collatz --preset cpu_only collatz_runner.sh unsure
[-26.889ms; -0.222ms] or [-0.676%; -0.006%]

@pr-commenter

pr-commenter Bot commented Oct 28, 2025

Copy link
Copy Markdown

Benchmark results for BadBoggleSolver_run

Parameters

Baseline Candidate
config baseline candidate
profiler-version ddprof 0.21.0+205b2320.80056045 ddprof 0.21.0+a922cfd1.80474070

Summary

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

See unchanged results
scenario Δ mean execution_time
scenario:ddprof -S bench-bad-boggle-solver BadBoggleSolver_run work 1000 same

@nsavoire
nsavoire merged commit 2239fe4 into main Oct 28, 2025
2 checks passed
@nsavoire
nsavoire deleted the nsavoire/cxx_allocators_instrumentation branch October 28, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant