dd-trace-php icon indicating copy to clipboard operation
dd-trace-php copied to clipboard

perf(profiling): shrink the size of ZendFrame

Open morrisonlevi opened this issue 1 year ago • 2 comments

PROF-9925

Description

Previously, each frame was 7 * 64 bits. They are now 3 * 64 bits, at the cost that there are slightly more String copies than before. This PR is an attempt to see if this trade-off is worth it.

The current status is that when things are fetched from cache, or if the inserting thing returns a borrowed Cow<str> such as for filenames, then we have the same number of copies as before. Function names are going to return an owned Cow<str>, though, and in this case we have an extra copy compared to before. The benchmarks that the PR bot posts do not capture this case.

Reviewer checklist

  • [ ] Test coverage seems ok.
  • [ ] Appropriate labels assigned.

morrisonlevi avatar Jun 11 '24 19:06 morrisonlevi

Benchmarks

Benchmark execution time: 2024-06-12 23:26:42

Comparing candidate commit a8fc7ffaf2c224eb36fa088733a718e3f1bada75 in PR branch levi/smaller-frames with baseline commit 9f4a6a50e8c487127431af623037a08d9dc1c2b1 in branch master.

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

scenario:walk_stack/1

  • 🟩 wall_time [-556.277ns; -528.070ns] or [-2.347%; -2.228%]

scenario:walk_stack/99

  • 🟩 wall_time [-725.636ns; -696.953ns] or [-2.885%; -2.771%]

scenario:walk_stack_instructions/1

  • 🟩 instructions [-6.2K instructions; -6.2K instructions] or [-5.991%; -5.980%]

scenario:walk_stack_instructions/50

  • 🟩 instructions [-5.5K instructions; -5.4K instructions] or [-5.260%; -5.231%]

scenario:walk_stack_instructions/99

  • 🟩 instructions [-4.3K instructions; -4.3K instructions] or [-4.142%; -4.114%]

pr-commenter[bot] avatar Jun 11 '24 19:06 pr-commenter[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.40%. Comparing base (9f4a6a5) to head (a8fc7ff).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2709      +/-   ##
============================================
+ Coverage     79.12%   79.40%   +0.28%     
  Complexity     2212     2212              
============================================
  Files           201      201              
  Lines         22451    22544      +93     
============================================
+ Hits          17764    17901     +137     
+ Misses         4687     4643      -44     
Flag Coverage Δ
tracer-extension 78.63% <ø> (+0.48%) :arrow_up:
tracer-php 80.52% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 12 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9f4a6a5...a8fc7ff. Read the comment docs.

codecov-commenter avatar Jun 12 '24 23:06 codecov-commenter