BenchmarkTools.jl icon indicating copy to clipboard operation
BenchmarkTools.jl copied to clipboard

ERROR: DomainError with -43.0: log will only return a complex result if called with a complex argument. Try log(Complex(x)).

Open viraltux opened this issue 4 years ago • 5 comments

in BenchmarkTools v1.1.1 and v1.1.2 the following benchmark produces an error.

julia> @benchmark for i in 1:100 sin(x[i]) end  setup = (x = rand(100)) evals = 1 samples = 100
BenchmarkTools.Trial: 100 samples with 1 evaluation.
 Range (min … max):  836.000 ns …  10.789 μs  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):       1.006 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):     1.109 μs ± 981.010 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%Error showing value of type BenchmarkTools.Trial:                                          
ERROR: DomainError with -8.0:
log will only return a complex result if called with a complex argument. Try log(Complex(x)).
Stacktrace:

viraltux avatar Aug 05 '21 10:08 viraltux

I also encountered this error in a different benchmark, which also used multiple samples.

It is also not hard to find the source of the error: The code that computes the bins for the histogram of the times assumes that the times are sorted, which is not the case.

felix-eku avatar Aug 14 '21 21:08 felix-eku

When was this issue introduced into the code base?

lucifer1004 avatar Aug 25 '21 03:08 lucifer1004

When implementing the new display method, I noticed that the times were always sorted. I'm surprised to hear this isn't always the case? I tried running that benchmark and I didn't see any error.

image

tecosaur avatar Aug 25 '21 03:08 tecosaur

I also ran into this issue, which occurred at times.

lucifer1004 avatar Aug 25 '21 03:08 lucifer1004