DIY::Thread.profile -- Light-Weight Profiling in Pure Ruby
summary
Builds a light-weight sampling profiler in pure Ruby using the Thread APIs (notably thread.list and backtrace), running roughly 10 samples per second and aggregating counts into a call tree; measured overhead averages 1.7 milliseconds per sample so short production runs (2–15 minutes) are viable. It works but has gotchas: sampling favors IO over CPU, memory grows with retained trees, MRI 1.9.x and JRuby backtraces are flaky, and millisecond-scale tasks may be missed.
AI-written summary · about
chapters (4)
related talks
26mHow a Ruby profiler works: Stackprof under a microscope
37mThe Future of Ruby Performance Tooling
43mReal World Ruby Performance at Scale
29mext/profile, or How to Make Profilers Tell the Truth
34mMetric Driven Development with Ruby on Rails
39mProfiling and Benchmarking 101
29mChasing Real-Time Observability for CRuby
36mDebugging Ruby
