Hacker News new | past | comments | ask | show | jobs | submit login

> 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.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: