Cod3xDocs
example

Profile a Hot Path With Pr0f1l3r

A minimal Pr0f1l3r investigation sequence.

When a feature is slow, begin with a narrow question.

If Pr0f1l3r is installed, its interface exposes bounded profiling modes such as call counting, timing, allocation attribution, throughput windows, and JIT capture.

From a compatible runtime script:

local I = require 'openmw.interfaces'

I.pr0f1l3r.setScenario('combat-target-update')
I.pr0f1l3r.benchTime('scripts/s3/music/combatState.lua')

Reproduce the same workload during the capture window.

Then ask:

  1. Is the function actually being called as often as assumed?
  2. Is Lua time material?
  3. Does memory attribution point at allocation churn?
  4. Are engine-bound operations the real cost?
  5. Only then: does JIT trace behavior matter?

For a broader window:

I.pr0f1l3r.benchWindow(300, 'combat-target-update')

Profiler facilities are diagnostic and can perturb the workload. Do not compare incompatible modes as though they were identical benchmarks.

See Pr0f1l3r and Measure First.