Profiling
Benchmark tests are useful for checking a portion of code, but they are not suitable for checking the performance of a working application. If you need to explore the performance of some of the functions of the code, you have to use a profiler.
Profilers dump information about code and function executions and record the time spans during which the code works. There is a profiler in the Rust ecosystem called flame. Let's explore how to use it.
Profiling takes time and you should use it as a feature to avoid affecting performance in production installations. Add the flame crate to your project and use it as an optional. Add a feature (such as the official examples from the flamer crate repository; I named the feature flame_it) and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access