-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Description
I ran into this issue when benchmarking a long running function in the REPL where display is automatic:
julia> @benchmark long_running()
It can be easily replicated with
@benchmark sleep(5)
or
@benchmark 1+1 samples=1
To get a nicer error message, I displayed explicitly with this:
julia> display(@benchmark sleep(5))
BechmarkTools.Trial: 1 samples with 1 evaluations.
Range (min … max): 5.004 s … 5.004 s ┊ GC (min … max): 0.00% … 0.00%
Time (median): 5.004 s ┊ GC (median): 0.00%
Time (mean ± σ): 5.004 s ± NaN s ┊ GC (mean ± σ): 0.00% ± NaN%ERROR: BoundsError: attempt to access 1-element Vector{Float64} at index [0]
Stacktrace:
[1] getindex
@ ./array.jl:801 [inlined]
[2] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, t::BenchmarkTools.Trial)
@ BenchmarkTools ~/.julia/packages/BenchmarkTools/Rqvks/src/trials.jl:441
[3] (::REPL.var"#38#39"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:220
[4] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:462
[5] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:213
[6] display(d::REPL.REPLDisplay, x::Any)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:225
[7] display(x::Any)
@ Base.Multimedia ./multimedia.jl:328
[8] top-level scope
@ ~/.julia/packages/BenchmarkTools/Rqvks/src/execution.jl:389
I'd rather get this:
julia> display(@benchmark sleep(5))
BechmarkTools.Trial: 1 samples with 1 evaluations.
Range (min … max): 5.004 s … 5.004 s ┊ GC (min … max): 0.00% … 0.00%
Time (median): 5.004 s ┊ GC (median): 0.00%
Time (mean ± σ): 5.004 s ± NaN s ┊ GC (mean ± σ): 0.00% ± NaN%
Metadata
Metadata
Assignees
Labels
No labels