5 ms·
The article is much longer than I originally anticipated. If you're looking for some good bits, you could probably jump straight to here: http://trent.me/is-pr
by trentnelson 8y ago
The article is much longer than I originally anticipated. If you're looking for some good bits, you could probably jump straight to here: http://trent.me/is-prefix-of-string-in-table/#IsPrefixOfStringInTable_10 http://trent.me/is-prefix-of-string-in-table/#IsPrefixOfStri...
That discusses the last C implementation before I took a stab at the assembly versions.
The final assembly section was pretty juicy as well: http://trent.me/is-prefix-of-string-in-table/#IsPrefixOfStringInTable_x64_3-review http://trent.me/is-prefix-of-string-in-table/#IsPrefixOfStri....
I was investigating why an earlier assembly version was so slow, then ended up writing a version that unequivocally beat all the C and previous assembly versions across the board (both prefix and negative matching, and worst case false-positive matching (where up to three comparisons needed to be done)).
TL;DR with optimized data structures specifically geared toward SIMD instructions, you can definitely get sizable performance improvements in both C with intrinsics, and then again with raw assembly.