Nice post. It's an interesting look at how algorithmic complexity can be trumped by real-world details.
But I think you'll find that the performance is not exactly in the each_char (which is probably lazily evalutated) but is caused by:
Thanks, that’s super interesting! Good to consider for future block usage. I can’t think of a way to speed up the block setup and tear down, but I wonder if I’d pick any performance up by switching the hash keys to symbols. I’ll have to do some ‘sperimenting 👍🏻
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.