I typically do something like @time z = foo(x), so I tried it with @elapsed and this works if you discount the time it takes to assign to z:
julia> foo(x) = x*2 foo (generic function with 1 method) julia> y = @elapsed z=foo(4); (y,z) (0.001103395,8) On Friday, September 11, 2015 at 2:03:52 PM UTC-7, [email protected] wrote: > > The macros @time and @elapsed are handy for performance profiling, but > when I want to test for both accuracy and performance regressions in my > code I end up having to do the following: > > time = @elapsed(myfunc()) > value = myfunc() > > Ideally there would be a macro which does both. Does such a thing exist in > Julia? If not, where should I post the request to have this feature added? > > I know it is a simple modification to the @elapsed macro, one I could code > myself, but this is a common enough use case that I think it belongs in > Julia core. > > Thanks! >
