Geequlim / ECMAScript

Javascript binding for godotengine
MIT License
962 stars 84 forks source link

Profiling support? #88

Open lewiji opened 3 years ago

lewiji commented 3 years ago

Is there any way to profile Godot ECMAScript code? Either in the editor, or by some other means?

From a quick read of the source I don't think the profiling methods have been implemented, but is there some way to attach a different debugger than the Godot one? Or maybe even by running a build of the engine source and attaching a C++ debugger to that. Has anyone had any success?

Thanks.

lewiji commented 3 years ago

FWIW, I tried Valgrind but couldn't get much useful information out of it down to the level of individual JS functions.

I've instead just made a simple decorator for now that allows you to add @measure to functions in your TS project, and if you add the Performance.jsx script as autoload in your project, it will print microsecond-accurate timing info (in ms) to the Godot output.

You can also call the time and endTime functions directly to collect and record the timing information.

https://github.com/lewispollard/godot-ecma-perftools

It would be nice to support in-editor profiling but unsure what steps would need to be taken, for now this will do for my simple purposes.