BenchmarkTools.jl and VScode

‘’‘julia
using BenchmarkTools
@benchmark sort(data) setup=(data=rand(10))
‘’’
When I ran these code in Vs-code, errors as below:
BenchmarkTools.Trial: 10000 samples with 1000 evaluations.
ERROR: MethodError: no method matching median(::Vector{Float64})

Closest candidates are:
median(::AbstractVector{T} where T<:Real, ::AbstractWeights)
@ StatsBase C:\Users\zzzz.julia\packages\StatsBase\XgjIN\src\weights.jl:782
median(::BenchmarkTools.Trial)
@ BenchmarkTools C:\Users\zzzz.julia\packages\BenchmarkTools\QAv7m\src\trials.jl:129
median(::Distributions.Kolmogorov)
@ Distributions C:\Users\zzzz.julia\packages\Distributions\km0AH\src\univariate\continuous\kolmogorov.jl:27

Is there any issue in my BenchmarkTools package? Its version is 1.4.0

Works fine for me - have you somehow managed to shadow median? The method median(::Vector{Float64}) does exist unless you’ve somehow shadowed it.

Maybe, my friend also could run it successfully. How to confirm if I shadowed median(::Vector{Float64}) , and if it is true, how to fix it?

Do you have median =... somewhere in your code?

No, only below two lines of code:
using BenchmarkTools
@benchmark sort(data) setup=(data=rand(10))

Try restarting the REPL (either click the bin icon on your REPL and start a new one, or you can use the restart repl command (ctrl-shift-p then searching restart repl might work)). Then run those two lines.

If it still doesn’t work please provide the complete error.

Thank you for your help. :smile: