You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dot(w, x), sum(x, w) etc. seem to use a slow fallback implementation of dot:
1.7.2> using StatsBase
1.7.2> x = rand(1000); w = weights(rand(length(x)));
1.7.2> x = rand(1000); w = weights(rand(1000));
1.7.2> @btime dot($w, $x)
975.000 ns (0 allocations: 0 bytes)
244.6881117358608
1.7.2> @btime dot($w.values, $x)
85.151 ns (0 allocations: 0 bytes)
244.68811173586084
The same goes for calling sum(x, w) or wsum(x, w).
This is independent of the number of BLAS threads.
This is a pretty dramatic performance difference. Should StatsBase call BLAS.dot or is this something that should be improved in the fallback dot routine in Base?
The text was updated successfully, but these errors were encountered:
Good catch. We need to use the values field instead of passing AbstractWeights objects directly. I'm not sure we should implement dot for AbstractWeights objects, as the number of methods to implement would be very large if we start trying to use the fastest methods everywhere. A more reasonable goal is to ensure good performance only for methods which are specifically designed to take weights.
dot(w, x)
,sum(x, w)
etc. seem to use a slow fallback implementation of dot:The same goes for calling
sum(x, w)
orwsum(x, w)
.This is independent of the number of BLAS threads.
This is a pretty dramatic performance difference. Should StatsBase call
BLAS.dot
or is this something that should be improved in the fallbackdot
routine in Base?The text was updated successfully, but these errors were encountered: