[2.0.72] profiler within on_tick giving inconsistent results based on game.speed
Posted: Mon Dec 08, 2025 10:00 am
I'm getting inconsistent results from the in game profiler depending on the game.speed setting when using the profiler within an on_tick event. Running with game.speed = 1 is resulting in profile times 2x higher than when using game.speed = 1000. The profiler is .restart() and .stop() within the on_tick event function and so should not be affected by game speed at all.
Start a new game and run the following code:
Result is after 1000 ticks, the game will print the profiler which in my case is around 1.2ms. Next change the code's first line to be `game.speed = 1000` and run again. Result in my case is around 0.6ms.
I would expect these results to be about the same. There is certainly some variability in the results, but not nearly enough to explain the results being given.
Start a new game and run the following code:
Code: Select all
game.speed = 1
local start_tick = game.tick
local profiler = game.create_profiler(true)
script.on_event(defines.events.on_tick,
function(e)
profiler.restart()
if e.tick-start_tick == 1000 then
game.print(profiler)
script.on_event(defines.events.on_tick, nil)
end
profiler.stop()
end
)I would expect these results to be about the same. There is certainly some variability in the results, but not nearly enough to explain the results being given.