Optimize CSC matrix construction