Expand description
This module defines 256-bit vector implementations of memchr
and friends.
The main types in this module are One
, Two
and Three
. They are for
searching for one, two or three distinct bytes, respectively, in a haystack.
Each type also has corresponding double ended iterators. These searchers are
typically much faster than scalar routines accomplishing the same task.
The One
searcher also provides a One::count
routine for efficiently
counting the number of times a single byte occurs in a haystack. This is
useful, for example, for counting the number of lines in a haystack. This
routine exists because it is usually faster, especially with a high match
count, then using One::find
repeatedly. (OneIter
specializes its
Iterator::count
implementation to use this routine.)
Only one, two and three bytes are supported because three bytes is about
the point where one sees diminishing returns. Beyond this point and it’s
probably (but not necessarily) better to just use a simple [bool; 256]
array
or similar. However, it depends mightily on the specific work-load and the
expected match frequency.
Structs
- Finds all occurrences of a single byte in a haystack.
- An iterator over all occurrences of a single byte in a haystack.
- Finds all occurrences of three bytes in a haystack.
- An iterator over all occurrences of three possible bytes in a haystack.
- Finds all occurrences of two bytes in a haystack.
- An iterator over all occurrences of two possible bytes in a haystack.