A simple instrumentation-based profiler.
Profiler.startProfiling(); // Profiling is disabled by default, so you must always do this once before starting to call the profiling functions or they won't be recorded.Profiler.stopProfiling();Profiler.profileBlockStart("block1");
// Work you want to profile
Profiler.profileBlockEnd();Profiler.profileBlock("block3", {
// Work you want to profile
});@:build(hacksaw.profiler.Profiler.injectProfiler())
class Foo {
@:profile
public function bar() {
// Work you want to profile
}
}Profiler.profileBlockStart("block2");
// Work you want profile
Profiler.profileBlockEnd();
Profiler.dumpToJsonFile("profile_dump.json");Profiler.profileBlockStart("block2");
// Work you want profile
Profiler.profileBlockEnd();
trace(Profiler.dumpToJson());You can then open up chrome://tracing or https://www.speedscope.app/ to view the profile and inspect it.
You can run the unit tests with haxe test.hxml
thx.core
buddy(required for unit tests)