|
|
|
|
|
by eesmith
20 days ago
|
|
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. |
|