small optimizations for tocsr