performance: also avoid string dup in output

We follow a similar logic to 8225fee, that helper calls designed to
fetch the text for a span must be repeatedly passing huge strings
around.