use gallop search instead of binarySearch for dot products. much faster in nearly all cases
benchmarks for SparseVector#dot
so linear search for small arrays doesn’t seem to help
switch between “smart” loop for big sparse vectors, and simple loop for small ones