Hacker News new | ask | show | jobs
by Tringi 684 days ago
As awesome as these algorithms are, I can never imagine use case.

Any time I need to turn something into uppercase or lowercase, it's user's input or something Unicode. Which can be in any random language, so all the crazy Unicode casing rules apply.

I mean, Czech could work by canonical Unicode decomposition and then re-composition afer case change ...but the input can be in Russian or Greek. I can't imagine accelerating that, or rather taking into account all the ranges.

2 comments

There are lots of protocols that are ASCII case-insensitive, such as SMTP, IMAP, HTTP, DNS, … so this kind of code is common in the hot path of lots of networking software.
Ah, yeah, that's true.
If your input is Russian mixed with English, it might still be actually faster to do a first pass to process all the ASCII English range first with the aforementioned techniques, then do Russian later in the second pass: imagine you’ll have way less if branches to do.