3 ms·
> The example optimized code uses `String#each_char` which incurs an extra object allocation for each iteration You're right. To be closer to the real C code,
by byroot 2y ago
> The example optimized code uses `String#each_char` which incurs an extra object allocation for each iteration
You're right. To be closer to the real C code, I should have used `each_byte`, given the C code works with bytes and not codepoints nor characters.
But this is mostly meant as pseudo-code to convey the general idea, not as actually efficient code, so not a big deal.