4 ms·
But that's slower for small query sizes. This describes a few algorithms: http://0x80.pl/notesen/2018-10-18-simd-byte-lookup.html http://0x80.pl/notesen/2018-1
by ncruces 1y ago
But that's slower for small query sizes.
This describes a few algorithms:
http://0x80.pl/notesen/2018-10-18-simd-byte-lookup.html http://0x80.pl/notesen/2018-10-18-simd-byte-lookup.html
Both the alternative version by Geoff Langdale, and the special case for small sets, are substantially similar to the algorithms used in Hyperscan (truffle and shufti).
https://github.com/intel/hyperscan https://github.com/intel/hyperscan
Having something hard coded for spaces can be much faster, especially since 5 of the 6 characters are a range: a wrap-around subtraction and an unsigned less-than does the first 5; an equality compare does the other.