How to profile a Rust binary?

⚓ Rust    📅 2025-11-18    👤 surdeus    👁️ 3      

surdeus

Hi

In this issue we are discussing if we should reduce the buffer limit for Rustls streams from the default 64kb to 16kb.

I am using Apple Instruments to profile if there actually is a performance improvement when reducing it to 16kb. I have used Blackfire to profile PHP projects before, but I am not sure how to analyze these profiling runs for Rust projects.

What I did was a cargo build --release multiple times for both a buffer of 64kb and 16kb. Then I did multiple runs in Apple Instruments.

For e.g Allocations:

afbeelding

For both 16kb and 64kb I had similar amount of total bytes.

Also the total execution time did not really show any significant difference between the two options:

afbeelding

The Network Connection data sadly is always empty, in a few runs it shows data for other processes totally not related to the binary I'm profiling:

afbeelding

So I am wondering how I would actually profile a Rust binary?

  1. The difference between 64kb and 16kb probably would be subtle, but how to even detect subtle performance improvements?
  2. Each run has different numbers effected by many external factors, how to still derive conclusions despite this?
  3. Other tips on how to profile a Rust binary?

1 post - 1 participant

Read full topic

🏷️ Rust_feed