Optimizations for case-sensitive endsWith() check