Gut
Gut copied to clipboard
Add benchmark support
Very new to Godot, I come from the Golang world where I find unit benchmarks very useful. I plan to include some in my own small pet project, but was thinking it might be interesting to have this integrated into Gut. Here's a small POC in my project tree:
https://gitlab.com/ufoot/liquidwar7/-/blob/057522f31dee08dc798dffba7102c563e08b0de7/godot/scripts/bench/Bench.gd
Also below a screenshot of how it looks like when I run them:
I'm outputting the same lines a go test -bench
would output, it's super simple yet I think good enough. It just tells you what has been run, how many times the function was called, and how long was each call. The complete feature would include memory footprint etc. but I have no clue how to get this from Godot. Any insight welcome here.
No hurry, I'm very fine with keeping this within my project, but if it can be interesting for other people, I'd be happy to share and propose a pull request.
And thanks for the great work, Gut is very useful & convenient.
This looks like it could provide some useful information. This could work nicely with issue #162 to add extra data from test runs. PR's are always welcome. There's a couple other issues that I'll get to before this so if you would like to take a stab at adding it yourself please do so.
P.S. I was looking at the code and I think FuncRef
's call_funcv
function might make your life a little better in run
.
Thanks for the tip about call_funcv
. Interesting indeed. I'll try and wrap up a PR for it. Also agree #162 falls in the same category. At least the output should go to the same place and/or look the same -> it's extra information about the quality of the program, on top of knowing whether tests "just pass". Thanks again for the feedback.