Hacker News new | ask | show | jobs
by eesmith 22 days ago
That wouldn't work. As the "Nothing is set in stone" section points out, in Unicode 6.2 the MONGOLIAN VOWEL SEPARATOR went from space separator to a format character.
1 comments

Wouldn't matching a bit and excluding by another bit still be much cheaper?
There isn't much "much" to go around.

The best case is a simple mask. I don't see how that can be done, given how Unicode can reclassify if something is a whitespace.

The worst case is 25 if-equals tests, so I'll call it 25 cycles since most text is not whitespace.

A 32-bit multiplication, shift, an L1 lookup, and comparison is fast. Eyeballing I'll guess about 8 cycles.

A mask and compare would be, what, 2 cycles?

While the loop to read these code points -- likely with utf-8 decoding -- adds its own overhead, plus the function call overhead, of course.

I am very much not a low-level developer, so take these numbers with caution. They are meant only to give some estimate on what "much" means.