Hasty Briefsbeta

Bilingual

Zig Profiling on Apple Silicon

9 months ago
  • #profiling
  • #Zig
  • #Apple Silicon
  • Profiling tools for Zig on Apple Silicon Macs are limited compared to Linux.
  • Types of profilers covered: CPU time profilers (statistical and hardware event-based) and instrumentation profilers.
  • Linux tools like perf, valgrind, and tracy are not fully supported on Apple Silicon.
  • Apple provides interfaces for profiling: Mach Interface, DTrace Framework, and kperf.
  • Available tools for Apple Silicon: Samply, poop (Performance Optimizer Observation Platform), Tracy, and Apple Instruments.
  • Samply is a sampling profiler with a rich UI, easy to install via cargo or Homebrew.
  • Poop is a tool for comparing performance based on hardware counters, requires root privileges.
  • Tracy is a real-time instrumentation profiler but lacks callstack sampling on Apple Silicon.
  • Apple Instruments is powerful but slow, suitable for advanced profiling needs.
  • Conclusion: Samply and poop are recommended for quick performance checks and iterative optimization.