Closed mulimoen closed 4 years ago
That's a good change, these short functions are good candidates for inlining.
The benchmarks in this library does not gain or lose anything from this change.
I don't think they test mul_acc_mat_vec_csr
, what's tested there uses iterators, so this explains why there's no difference.
Thanks for finding this!
@vbarrielle I would expect all functions using SparseVector
to benefit from this, including the benched function dot_dense
. It might be that it is inlined automatically inside the crate, but does not pass across the crate barrier.
Yes that's very probable actually.
Adding the
#[inline]
attribute to the indexing operators got a speedup of 15-30% onmul_acc_mat_vec_csr
for some matrices. The benchmarks in this library does not gain or lose anything from this change.Further observations: Changing to unsafe access in
mul_acc_mat_vec_csr
does not modify the performance characteristics compared to the safe version.