jhawthorn / vernier

📏 next generation CRuby profiler
https://vernier.prof/
MIT License
803 stars 17 forks source link

README should mention low overhead #65

Open spuyet opened 5 months ago

spuyet commented 5 months ago

Hello, this is more a question than an issue but there is nothing related to the performance overhead added by vernier on a ruby program, did someone made a benchmark or something like that already ?

jhawthorn commented 5 months ago

It's hard to give a specific number, since there are a variety of factors. Vernier is a sampling profiler so we expect the overhead to be very low (and based on the sample rate set).

I did commit examples/measure_overhead.rb the first test of which shows that as expected there is almost no overhead:

$ ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]
Warming up --------------------------------------
         no profiler   737.000 i/100ms
             vernier   725.000 i/100ms
Calculating -------------------------------------
         no profiler      7.374k (± 0.4%) i/s -     37.587k in   5.096970s
             vernier      7.275k (± 0.2%) i/s -     36.975k in   5.082242s

Comparison:
         no profiler:     7374.5 i/s
             vernier:     7275.4 i/s - 1.01x  slower

The other tests in that file show that there is overhead associated with the optional allocation_sample_rate tracing (partly because that makes the VM take a slow path, partly just because of the cost to record the samples).

I'll leave this open as a reminder that I want to mention something in the README

spuyet commented 4 months ago

Nice, thx for the benchmark, I will give it a try in production and see how it goes then :)