Enum PrefilterConfig
enum PrefilterConfig
Prefilter controls whether heuristics are used to accelerate searching.
A prefilter refers to the idea of detecting candidate matches very quickly, and then confirming whether those candidates are full matches. This idea can be quite effective since it's often the case that looking for candidates can be a lot faster than running a complete substring search over the entire input. Namely, looking for candidates can be done with extremely fast vectorized code.
The downside of a prefilter is that it assumes false positives (which are candidates generated by a prefilter that aren't matches) are somewhat rare relative to the frequency of full matches. That is, if a lot of false positives are generated, then it's possible for search time to be worse than if the prefilter wasn't enabled in the first place.
Another downside of a prefilter is that it can result in highly variable performance, where some cases are extraordinarily fast and others aren't. Typically, variable performance isn't a problem, but it may be for your use case.
The use of prefilters in this implementation does use a heuristic to detect when a prefilter might not be carrying its weight, and will dynamically disable its use. Nevertheless, this configuration option gives callers the ability to disable prefilters if you have knowledge that they won't be useful.
Variants
-
None Never used a prefilter in substring search.
-
Auto Automatically detect whether a heuristic prefilter should be used. If it is used, then heuristics will be used to dynamically disable the prefilter if it is believed to not be carrying its weight.
Implementations
impl Clone for PrefilterConfig
fn clone(self: &Self) -> PrefilterConfig
impl Copy for PrefilterConfig
impl Debug for PrefilterConfig
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Default for PrefilterConfig
fn default() -> PrefilterConfig
impl Freeze for PrefilterConfig
impl RefUnwindSafe for PrefilterConfig
impl Send for PrefilterConfig
impl Sync for PrefilterConfig
impl Unpin for PrefilterConfig
impl UnsafeUnpin for PrefilterConfig
impl UnwindSafe for PrefilterConfig
impl<T> Any for PrefilterConfig
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for PrefilterConfig
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for PrefilterConfig
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for PrefilterConfig
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for PrefilterConfig
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for PrefilterConfig
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for PrefilterConfig
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for PrefilterConfig
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for PrefilterConfig
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>