3 ms·
It's really not that strange - it's probably intended debugging & profiling code. It sounds like Lua's debugging hook (http://www.lua.org/manual/5.1/manual.html
by silentbicycle 16y ago
It's really not that strange - it's probably intended debugging & profiling code. It sounds like Lua's debugging hook (http://www.lua.org/manual/5.1/manual.html#lua_sethook http://www.lua.org/manual/5.1/manual.html#lua_sethook), which can run a callback every N vm instructions.
I made a simple profiler by setting the hook to run every X ticks (typically 10,000), recording the call stack, and then seeing where most of the execution happens. If every other time you look at the vm, it's in the same place, then it's clearly a hotspot.
I don't know of an equivalent in Python or Ruby, off the top of my head, but I'd be surprised if they weren't available.