Hasty Briefsbeta

Bilingual

Using Perfetto in ZJIT

a day ago
  • Side-exits (or deopts) from JIT-compiled code to the interpreter degrade performance, and the goal is to minimize them.
  • ZJIT provides `--zjit-stats` to output counters on side-exits, C calls, and other slowdowns, but these lack spatial and temporal context.
  • Perfetto is a system for visualizing and analyzing traces, which can be used to see where and when side-exits occur in Ruby code.
  • Using SQL queries in Perfetto, one can aggregate side-exit events by reason and method to identify hotspots, such as guard shape failures.
  • Trace data can be emitted in JSON or the more compact Fuchsia trace format (FXT), with options to sample exits to reduce file size.
  • The blog post demonstrates how to set up Perfetto tracing in ZJIT and encourages community contributions for further exploration.