Asymptotically the pre-existing implementation is faster, because it's O(k) and this is O(n log n) with n >> k (k being nnz and n being shape[atom_axis]). For small problem sizes this might be faster due to less control being implemented in python.