This commit causes small (~5%) slowdown when processing strings that consist mostly of escaped characters, but improves throughput by about 100% for strings that consist mostly of characters that do not need escaping.