pub struct GOConf<GS: GroupSize = TwoToPowerBitsStatic<4>, SS: SeedSize = TwoToPowerBitsStatic<2>, S = BuildDefaultSeededHasher> {
pub hash_builder: S,
pub bits_per_seed: SS,
pub bits_per_group: GS,
}Expand description
Configuration of family of (group-optimized) hash functions used by GOFunction and accepted by GOBuildConf constructors.
Good configurations can be obtained by calling one of the following functions: default_biggest, default_bigger, default, default_smallest. These functions are listed in order of increasing performance (in terms of size and evaluation speed) and time to construct the minimum perfect hash function. More details are included in their documentation and the paper: P. Beling, Fingerprinting-based minimal perfect hashing revisited, ACM Journal of Experimental Algorithmics, 2023, https://doi.org/10.1145/3596453
Fields§
§hash_builder: SThe family of hash functions used by the constructed GOFunction. (default: BuildDefaultSeededHasher)
bits_per_seed: SSSize of seeds (in bits). (default: 4)
bits_per_group: GSSize of groups (in bits). (default: 16)
Implementations§
Source§impl GOConf<TwoToPowerBitsStatic<3>, TwoToPowerBitsStatic<0>, BuildDefaultSeededHasher>
impl GOConf<TwoToPowerBitsStatic<3>, TwoToPowerBitsStatic<0>, BuildDefaultSeededHasher>
Sourcepub fn default_biggest() -> Self
pub fn default_biggest() -> Self
Creates a configuration in which the seed and group sizes are 1 and 8 bits respectively, which (when relative level size is 100) leads to a minimum perfect hash function whose:
- size is about 2.52 bits per input key,
- the expected number of levels visited during the evaluation is about 2.18,
- construction takes about 4 times less time compared to the default configuration.
Source§impl GOConf<TwoToPowerBitsStatic<4>, TwoToPowerBitsStatic<1>, BuildDefaultSeededHasher>
impl GOConf<TwoToPowerBitsStatic<4>, TwoToPowerBitsStatic<1>, BuildDefaultSeededHasher>
Sourcepub fn default_bigger() -> Self
pub fn default_bigger() -> Self
Creates a configuration in which the seed and group sizes are 2 and 16 bits respectively, which (when relative level size is 100) leads to a minimum perfect hash function whose:
- size is about 2.36 bits per input key,
- the expected number of levels visited during the evaluation is about 2.04,
- construction takes about 3 times less time compared to the default configuration.
Source§impl GOConf<TwoToPowerBitsStatic<5>, Bits8, BuildDefaultSeededHasher>
impl GOConf<TwoToPowerBitsStatic<5>, Bits8, BuildDefaultSeededHasher>
Sourcepub fn default_smallest() -> Self
pub fn default_smallest() -> Self
Creates a configuration in which the seed and group sizes are 8 and 32 bits respectively, which (when relative level size is 100) leads to a minimum perfect hash function whose:
- size is about 2.10 bits per input key,
- the expected number of levels visited during the evaluation is about 1.64,
- construction takes about 13 times longer compared to the default configuration.
Source§impl<GS: GroupSize, SS: SeedSize, S: BuildSeededHasher> GOConf<GS, SS, S>
impl<GS: GroupSize, SS: SeedSize, S: BuildSeededHasher> GOConf<GS, SS, S>
Sourcepub fn hash_bps_bpg(
hash_builder: S,
bits_per_seed: SS,
bits_per_group: GS,
) -> Self
pub fn hash_bps_bpg( hash_builder: S, bits_per_seed: SS, bits_per_group: GS, ) -> Self
Returns a configuration that uses given family of hash functions and seeds and groups of the sizes given in bits.
Sourcepub fn hash_index<GetGroupSeed>(
&self,
hash: u64,
level_size_groups: usize,
group_seed: GetGroupSeed,
) -> usize
pub fn hash_index<GetGroupSeed>( &self, hash: u64, level_size_groups: usize, group_seed: GetGroupSeed, ) -> usize
Returns array index for given hash of key, size of level in groups, and group seed provided by group_seed.
Trait Implementations§
Source§impl Default for GOConf
impl Default for GOConf
Source§fn default() -> Self
fn default() -> Self
Creates a configuration in which the seed and group sizes are 4 and 16 bits respectively, which (when relative level size is 100) leads to a minimum perfect hash function whose:
- size is about 2.21 bits per input key,
- the expected number of levels visited during the evaluation is about 1.73.
Auto Trait Implementations§
impl<GS, SS, S> Freeze for GOConf<GS, SS, S>
impl<GS, SS, S> RefUnwindSafe for GOConf<GS, SS, S>
impl<GS, SS, S> Send for GOConf<GS, SS, S>
impl<GS, SS, S> Sync for GOConf<GS, SS, S>
impl<GS, SS, S> Unpin for GOConf<GS, SS, S>
impl<GS, SS, S> UnsafeUnpin for GOConf<GS, SS, S>
impl<GS, SS, S> UnwindSafe for GOConf<GS, SS, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more