3 ms·
Using vectorization to speed up UTF-8 character counting
- nilobject 18y agoI thought the title meant it was using Altivec or SSE, but it's merely operating on a chunk of 4 bytes at a time dealing with misaligned data up front. Still a good article, despite my initial disappointment. A similar article which originally taught me these tenants is: http://rentzsch.com/papers/straightenUpAndFlyRight http://rentzsch.com/papers/straightenUpAndFlyRight
- cperciva 18y agoit's merely operating on a chunk of 4 bytes at a time If you have a modern CPU, that code operates on 8 bytes at a time. :-)
- ajross 18y agoI don't think I believe those benchmarks. Many of those numbers are significantly slower (!) than main memory bandwidth, and for code like strlen() which can be naively implemented in about three instructions per byte. Something is wrong with the testing, I think.