Open Aidiakapi opened 10 years ago
There are two ways I've considered for this: (1) integration with LuaJIT profiler since ZBS includes LuaJIT by default, and (2) Lua only profiler. The obvious benefit of (2) is that it works with any engine, while the obvious disadvantage is that its accuracy can be quite off as it's based on debug.hook. The main disadvantage of (1) is that you may not want to rely on it if your engine is not LuaJIT-based, but it should still be a good way to identify bottlenecks and you can run it with jit.off
to make it execution to be closer to "normal" Lua.
The interesting part is how to present the profiling results to make it useful and well integrated with the IDE. I'm open to suggestions...
Proof of concept: https://github.com/CapsAdmin/zbprofiler
@pkulchenko Is that a heat diagram for percentage of overall time? I would also consider adding the number of times a line is run and related metrics.
@abigpotostew, yes, but there is a limited number of gradations as it's done with markers and there are only few of them in the editor. Yes, number of times a line is run would be interesting to add as well.
Take a look at http://howl.io/blog/2016/05/26/introducing-aullar.html#aullar as a replacement (?) for Scintillia.
@gschenck, it's not related to this ticket, but I'll answer it briefly. I definitely follow Howl with interest and carefully reviewed their rationale for switching away from Scintilla. Here is why some of that rationale doesn't apply to this project:
Couple of notes on this: ProFi profiler, sampling profiler for Lua 5.3, interactive continuous Python profiler, profile format used by DProf, and couple of screenshots from Unreal profiler: 1 and 2.
When it comes to performance Lua is an odd bird. It's hybrid table implementation and all strings being interned makes it hard to sometimes see where the lost time is.
For performance testing it'd be great to have a profiler available. After all, first measure, then optimize.
I realize there are some Lua libraries for profiling out there, but they're mostly cumbersome to use, not flexible, and most essentially, not very accurate. I'm quite positive that in C(++), an implementation could be much better.