Skip to content

Instantly share code, notes, and snippets.

@Shilo
Created February 21, 2024 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shilo/340599c74d8d877825ddbf3b4db24321 to your computer and use it in GitHub Desktop.
Save Shilo/340599c74d8d877825ddbf3b4db24321 to your computer and use it in GitHub Desktop.
Simple Benchmark methods in Godot.
public static void Benchmark(Action callable, string tag = null)
{
var start = Time.GetTicksMsec();
callable();
var duration = Time.GetTicksMsec() - start;
if (tag != null)
GD.PrintT(tag, duration);
else
GD.Print(duration);
}
func benchmark(callable: Callable, tag: String = null):
var start: int = Time.get_ticks_msec()
callable.call()
var duration: int = Time.get_ticks_msec() - start
if tag:
printt(tag, duration)
else:
print(duration)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment