0Pricing
Lua Academy · Lesson

Profiling with jit.p and perf

Profile Lua code with jit.p, annotate hot paths, and reduce allocations.

Why Profile?

Profiling identifies which functions consume the most CPU time. Without profiling, optimization efforts are often misdirected to code that is not the bottleneck.

jit.p: LuaJIT Built-in Profiler

LuaJIT includes jit.p, a sampling profiler. Enable it from the command line or inside the script.

-- Command line:
luajit -jp=s script.lua
-- Or inside script:
require("jit.p").start("s")  -- sample at function level
-- ... code ...
require("jit.p").stop()

All lessons in this course

  1. LuaJIT Architecture Overview
  2. Writing JIT-Friendly Lua
  3. Profiling with jit.p and perf
  4. Benchmarking Patterns
← Back to Lua Academy