Skip to main content

GOConf

Struct GOConf 

Source
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: S

The family of hash functions used by the constructed GOFunction. (default: BuildDefaultSeededHasher)

§bits_per_seed: SS

Size of seeds (in bits). (default: 4)

§bits_per_group: GS

Size of groups (in bits). (default: 16)

Implementations§

Source§

impl GOConf<TwoToPowerBitsStatic<3>, TwoToPowerBitsStatic<0>, BuildDefaultSeededHasher>

Source

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>

Source

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>

Source

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> GOConf<GS, SS>

Source

pub fn bps_bpg(bits_per_seed: SS, bits_per_group: GS) -> Self

Returns a configuration that uses seeds and groups of the sizes given in bits.

Source§

impl<GS: GroupSize, SS: SeedSize, S: BuildSeededHasher> GOConf<GS, SS, S>

Source

pub fn validate(&self)

Panics if the configuration is incorrect.

Source

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.

Source

pub fn hash_index<GetGroupSeed>( &self, hash: u64, level_size_groups: usize, group_seed: GetGroupSeed, ) -> usize
where GetGroupSeed: FnOnce(usize) -> u16,

Returns array index for given hash of key, size of level in groups, and group seed provided by group_seed.

Source

pub fn key_index<GetGroupSeed, K>( &self, key: &K, level_seed: u64, level_size_groups: usize, group_seed: GetGroupSeed, ) -> usize
where GetGroupSeed: FnOnce(usize) -> u16, K: Hash,

Returns array index for given key, seed and size (in groups) of level, and group seed provided by group_seed.

Trait Implementations§

Source§

impl<GS: Clone + GroupSize, SS: Clone + SeedSize, S: Clone> Clone for GOConf<GS, SS, S>

Source§

fn clone(&self) -> GOConf<GS, SS, S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for GOConf

Source§

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.
Source§

impl<GS: GroupSize + Sync, SS: SeedSize, S: BuildSeededHasher + Sync> From<GOConf<GS, SS, S>> for GOBuildConf<GS, SS, S>

Source§

fn from(value: GOConf<GS, SS, S>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<GS, SS, S> Freeze for GOConf<GS, SS, S>
where S: Freeze, SS: Freeze, GS: Freeze,

§

impl<GS, SS, S> RefUnwindSafe for GOConf<GS, SS, S>

§

impl<GS, SS, S> Send for GOConf<GS, SS, S>
where S: Send, SS: Send, GS: Send,

§

impl<GS, SS, S> Sync for GOConf<GS, SS, S>
where S: Sync, GS: Sync,

§

impl<GS, SS, S> Unpin for GOConf<GS, SS, S>
where S: Unpin, SS: Unpin, GS: Unpin,

§

impl<GS, SS, S> UnsafeUnpin for GOConf<GS, SS, S>
where S: UnsafeUnpin, SS: UnsafeUnpin, GS: UnsafeUnpin,

§

impl<GS, SS, S> UnwindSafe for GOConf<GS, SS, S>
where S: UnwindSafe, SS: UnwindSafe, GS: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CastableFrom<T> for T

Source§

fn cast_from(value: T) -> T

Call Self as W
Source§

impl<T, U> CastableInto<U> for T
where U: CastableFrom<T>,

Source§

fn cast(self) -> U

Call W::cast_from(self)
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DowncastableFrom<T> for T

Source§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
Source§

impl<T, U> DowncastableInto<U> for T
where U: DowncastableFrom<T>,

Source§

fn downcast(self) -> U

Call W::downcast_from(self)
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Splat<T> for T

Source§

fn splat(value: T) -> T

Source§

impl<T> To<T> for T

Source§

fn to(self) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UpcastableFrom<T> for T

Source§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
Source§

impl<T, U> UpcastableInto<U> for T
where U: UpcastableFrom<T>,

Source§

fn upcast(self) -> U

Call W::upcast_from(self)
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V