using Distances

v1=rand(10000)
v2=rand(10000)
function testDistances(v1::Array{Float64,1}, v2::Array{Float64,1}, 
D::SemiMetric)
    for i in 1:5000
                    evaluate(D,v1,v2)
    end
end
    
 @time testDistances(v1,v2,Jaccard())
 18.351446 seconds (350.02 M allocations: 5.961 GB, 8.04% gc time)

julia> @time testDistances(v1,v2,CosineDist())
  0.219039 seconds (4 allocations: 160 bytes)

julia> @time testDistances(v1,v2,Cityblock())
  0.044441 seconds (4 allocations: 160 bytes)

julia> @time testDistances(v1,v2,Euclidean())
  0.031838 seconds (4 allocations: 160 bytes)

Any fix possible ?

Reply via email to