Skip to content

Commit

Permalink
uodate performance-on-cpu.md
Browse files Browse the repository at this point in the history
Signed-off-by: Roshan Khatri <[email protected]>
  • Loading branch information
roshkhatri authored Sep 9, 2024
1 parent 667de85 commit aa79c1c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions topics/performance-on-cpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,18 @@ For a proper On-CPU analysis, Valkey (and any dynamically loaded library like
Valkey Modules) requires stack traces to be available to tracers, which you may
need to fix first.

By default, Valkey is compiled with the `-O3` optimization flag, which enables
a high level of compiler optimizations that aim to maximize runtime performance.
These optimizations can significantly enhance performance. Valkey is also compiled with
the `-fno-omit-frame-pointer` flag by default, ensuring that the frame pointer is preserved across
function calls. This combination allows for precise stack walking and call stack tracing,
which is essential for accurate profiling and debugging. Keeping the frame pointer
By default, Valkey is compiled with the `-O3` optimization flag (which we intent to keep
during profiling). This means that compiler optimizations are enabled which significantly
enhance the performance. Valkey is also compiled with the `-fno-omit-frame-pointer` flag
by default, ensuring that the frame pointer is preserved across function calls.
This combination allows for precise stack walking and call stack tracing,
which is essential for accurate profiling and debugging. Keeping the frame pointer
intact helps profiling tools like `perf`, `gdb`, and others correctly attribute on-CPU
time to deeper call stack frames, leading to more reliable insights into performance bottlenecks
and hotspots. This setup strikes a balance between maintaining a highly optimized executable
and ensuring that profiling and tracing tools provide accurate and actionable data.

It's important that you ensure that:
- debug information is present: compile option `-g`
- frame pointer register is present: `-fno-omit-frame-pointer`
- we still run with optimizations to get an accurate representation of production run times, meaning we will keep: `-O3`

You can do it as follows within valkey main repo:
Expand Down

0 comments on commit aa79c1c

Please sign in to comment.