Re:Wc2: Investigates optimizing 'wc', the Unix word count pr...
by jxndnxu on Thursday June 20, 2024 @03:41PM
(#40742477)
You have answered your question yourself: your algorithm looks at each byte twice, not once
It's even more obvious in the UTF case where the classic implementation first looks at 1-4 byte to parse a character and only then checks if it's a space
It's even more obvious in the UTF case where the classic implementation first looks at 1-4 byte to parse a character and only then checks if it's a space