JuliaMath / NaNMath.jl

Julia math built-ins which return NaN and accumulator functions which ignore NaN
Other
53 stars 28 forks source link

SIMD mean() #43

Closed Moelf closed 3 years ago

Moelf commented 3 years ago

as discussed in #42

mlubin commented 3 years ago

Could you show some benchmarks across different array sizes?

Moelf commented 3 years ago
julia> for n = 2:8
           v = rand([0:0.1:1;NaN], 10^n)
           @time NaNMath.mean(v)
           @time my_mean_count(v)
           @assert NaNMath.mean(v) == my_mean_count(v)[1]
           println("------")
       end
  0.000000 seconds
  0.000000 seconds
------
  0.000003 seconds
  0.000002 seconds
------
  0.000029 seconds
  0.000016 seconds
------
  0.000203 seconds
  0.000151 seconds
------
  0.002130 seconds
  0.001343 seconds
------
  0.021318 seconds
  0.013495 seconds
------
  0.209481 seconds
  0.133376 seconds
------
Moelf commented 3 years ago

should a new release be tagged? NaNMath is extremely mature, I don't know how releases are usually done in this case

mlubin commented 3 years ago

Done: https://github.com/JuliaRegistries/General/pull/24913