-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Labels
Description
Hi, thanks for making this fantastic module! One of the many reasons I love Julia. :-)
I think it would be great if BenchmarkTools came with a macro to report the number of allocations (not bytes), i.e. like @ballocated, but return alloc(...).
This seems to work... maybe this can be considered for inclusion directly in this module?
macro ballocs(args...)
return esc(quote
$BenchmarkTools.allocs($BenchmarkTools.minimum($BenchmarkTools.@benchmark $(args...)))
end)
end
I use it in my project ( https://github.com/claforte/RayTracingWeekend.jl )'s tests to keep the number of heap allocations to a minimum.