8:16 pm, October 14, 2014
0
Lutz in How to profile lua code
From patch 1.1.1824 on it is possible to measure the execution time of the lua code you're developing. We recommend doing this in order to ensure that your code performs well under different circumstances, e.g. when the friend list is long, the inventory is full or when there is tons of loot. We're doing it internally as well.
To enable the profiler, open the console (alt+f1) and enter
If your function gets called from game code and it takes longer than a millisecond (by default) to execute, then the system will log a line to the console like this:
Of course, you have to replace 'myfunction' by whatever the name of your lua function is. You can also filter by the name of the ui component or omit this line to profile all lua callbacks.
You can change the threshold above which execution times are logged with ui_ProfileCallbacksThreshold, e.g.
will set the threshold to 10 milliseconds. Do this if the logs get too spammy. At the company we're aiming to stay below a millisecond (remember, you're not the only system in the game), which we don't always achieve yet, but we're actively working on it. Anything above 10 milliseconds creates a hitch that interrupts fluid gameplay.
For more info, see here.
To enable the profiler, open the console (alt+f1) and enter
Code:
ui_ProfileCallbacks 1
ui_ProfileCallbacksFilter myfunction
Code:
00:52 RAM:1504MB FPS:60 WARN GUILIB Execution time 1234 us for myluafile - myfunction
You can change the threshold above which execution times are logged with ui_ProfileCallbacksThreshold, e.g.
Code:
ui_ProfileCallbacksThreshold 10000
For more info, see here.
References
No Comments