document: Optimize replace_spacing to pregrow output buffer