Optimize for large test cases