~/talk

How a Ruby profiler works: Stackprof under a microscope

Talkat Euruko 2025 · 2025-09-18..09-19· [ruby]
slides:none on file

Stackprof profiles Ruby with just ~2,000 lines of C and Ruby by sampling (typical intervals 1–10 ms) instead of tracing every call, uses setitimer/sigaction (SIGALRM for wall, SIGPROF for CPU), captures stacks via RB_profile_frames, and defers unsafe work with the postpone_job API to store either raw or aggregated samples. It supports allocation, CPU and wall modes, emits stack collapse output for flamegraphs (speedcope compatible), is low overhead, and shows limits on many-threaded apps.

AI-written summary · about

  1. 0:00StackProf and Ruby profiling
  2. 4:21Sampling in profilers
  3. 8:11Four profiler components
  4. 12:24CPU vs wall time sampling
  5. 15:34Postpone jobs for safety
  6. 19:27Efficient sample storage
  7. 21:57Flame graphs from results
  8. 23:43StackProf's power
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.