Portable application-level profiling for MoonBit with scoped timing and bounded statistics.
moon add f4ah6o/hotpath@0.1.0import {
"f4ah6o/hotpath/src" @hotpath,
}let profiler = @hotpath.Profiler::new()
let value = profiler.measure("parse", fn() {
// work
42
})
profiler.measure("render", fn() {
// more work
()
}) |> ignore
println(profiler.render_text())let tick = Ref::new(0L)
let now = fn() {
let current = tick.val
tick.val = current + 10L
current
}
profiler.measure_with("fake", now, fn() { () }) |> ignorelet profiler = @hotpath.ProfilerNs::new()
let value = profiler.measure_ns_with("input.handle", monotonic_now_ns, () => work())
println(profiler.render_text())moon check --target all
moon test --target all
moon bench --target native
moon fmt --checkInstall
Download zipPortable application-level profiling for MoonBit with scoped timing and bounded statistics.