I would like a debugging API to help identify performance bottlenecks. For instance:
Code: Select all
t1 = util.timestamp()
do_order_n_cubed_operations()
print ("function took", util.timestamp() - t1, "nanoseconds")
Code: Select all
t1 = util.timestamp()
do_order_n_cubed_operations()
print ("function took", util.timestamp() - t1, "nanoseconds")
Code: Select all
--enable-performance-debugging
Code: Select all
log("something")
Code: Select all
t0 = os.clock()
-- do stuff
print(os.clock()-t0)
If that's the case then just disable or edit the offending mod? Having access to os.time etc would make it much easier for modders to find out which specific lines, loops, etc., are hogging the most CPU in their mods.keyboardhack wrote:This would be nice but someone will probably use it incorrectly by only processing entities for n miliseconds per tick which would break multiplayer.
Well the typical mod user probably won't know which mod is causing the foobar leading to desync posts on the forum leading to devs spending time finding the offending mod, leading to the eventual discontinuince of said OS stuff again.If that's the case then just disable or edit the offending mod?
Code: Select all
/measured-command game.player.print 'how much time does this take to run?'