Build on @wch's work with a faster escaper

This avoids the initial runthrough counting matches to allocate an exact length, and instead overallocates up to the maximum possible length. Testing shows this to be ~2-3x faster.