I was thinking it may be possible to treat multibyte unicode spaces as multibyte needles in the haystack of the narrow string, and do some kind of search for them. But this gets into the domain of regexes, and arguably, it's not really going to improve performance *that*  much.

Ultimately, though, it's actual benchmarks that have the final say. If the current code is reasonably-performant, then I'd say it's good enough (esp. since it's especially readable in its current form -- it'd be a pity to lose that).