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:
- Is the function actually being called as often as assumed?
- Is Lua time material?
- Does memory attribution point at allocation churn?
- Are engine-bound operations the real cost?
- 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.