rbxts-flamework / core

Flamework is an extensible game framework. It requires typescript and offers many useful features.
MIT License
112 stars 8 forks source link

Transformer option for automatic debug profiling #78

Closed jackTabsCode closed 1 year ago

jackTabsCode commented 1 year ago

Flamework already provides debug memory category tracking, but it'd be nice to have an option for flamework to automatically transform my source code such that there is debug.profilebegin() and debug.profileend() in onInit, onStart, onTick, etc methods. It would make performance optimization a lot easier so I don't have to manually add them.

(or you could do it by default if you want—but I'm not entirely sure of the performance implications of the tracebacks themselves.)

jackTabsCode commented 1 year ago

Updated name to debug.profilebegin() and debug.profileend(). No idea why I put debug.traceback() in initial issue, brain wasn't working

Fireboltofdeath commented 1 year ago

I'll likely exclude OnInit from profilebegin/profileend as it's sequential and can yield, which isn't very friendly when it comes to the microprofiler APIs. Fortunately, I don't think profiling functions which are only called once would be very useful.

I'm also going to have the memory category code under the same profiling option (which is enabled in studio by default) just to keep things consistent.