Skip to content

Reduce Profiler overhead #9225

Closed
Closed

Description

@asfernandes

The goal is to reduce the performance impact of profiling through two complementary approaches:

  1. Optimize the hot path: Reduce the overhead of collecting timing samples by making the profiling code faster and minimizing work performed during each sample. Some of these changes are also expected to slightly improve the performance of non-profiled code.
  2. Add asynchronous sampling (default mode): Introduce a new profiling mode that collects timing samples from a separate thread, reducing the instrumentation overhead on the profiled attachment. This should become the default mode.

The existing synchronous sampling mode should remain available as an alternative.

Activity

  1. self-assigned this
    on Oct 21, 2026
  2. added a commit that references this issue on Nov 11, 2026
  3. asfernandes commented on Nov 11, 2026

    @asfernandes
    MemberAuthor

    Conclusions

    • Sampled mode: compared with master's profiling, the default sampled mode (100 µs) cuts the overhead by 87–91% for statements and fetches, and by 60% for very short procedure calls. A profiled run takes 1.13–1.31x the unprofiled time, and 1.51x for 1M empty procedure calls, compared with 2.2–3.0x on master.
    • Sampling interval:
      • The overhead is the same from 1000 to 50 µs within the run-to-run spread, so 100 µs, the default, gives 10x the samples of 1000 µs, and so more precise times for short items, at no extra cost.
      • At 50 µs, the minimum, only the procedure-call test showed a higher overhead, by 7%. That is still 58% below master.
    • Measured mode: it reports times within a few percent of the unprofiled times, and its overhead is 4–17% lower than master's, which reports wrong times.
    • Profiler off: the branch is not slower than master: 4–11% faster in the PSQL and SELECT tests and 1% faster in the join. The PSQL cursor gains the most.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions