pub struct SimdDualTableWithHashLookup<'a> { /* private fields */ }Expand description
Dual table lookup kernel using FxHashMap for table2.
This kernel is optimized for the case where table2 has a very small number of entries (sparse), making a hash map lookup more memory-efficient than a full lookup table. NOTE: We also tried writing a kernel with PHF-based EntropyMap, but it is slower than the HashMap version.
- Table1: Standard
&[u8]lookup table (can be large) - Table2:
FxHashMap<u32, u8>(optimized for sparse data with fast hashing)
The lookup behavior is the same as SimdDualTableU32U8Lookup:
- Table2 is only looked up if table1 returns a non-zero value
- Results are passed to the user function as (u8x16, u8x16, num_bytes)
UPDATE: Testing on Intel Xeon shows that this kernel is maybe 20% slower than the V2 kernel with an optimized writer.
Implementations§
Source§impl<'a> SimdDualTableWithHashLookup<'a>
impl<'a> SimdDualTableWithHashLookup<'a>
Sourcepub fn new(
lookup_table1: &'a [u8],
lookup_table2: &'a FxHashMap<u32, u8>,
) -> Self
pub fn new( lookup_table1: &'a [u8], lookup_table2: &'a FxHashMap<u32, u8>, ) -> Self
Creates a new dual table lookup kernel with table1 as a slice and table2 as FxHashMap.
Sourcepub fn lookup_func<F>(&self, values1: &[u32], values2: &[u32], f: &mut F)
pub fn lookup_func<F>(&self, values1: &[u32], values2: &[u32], f: &mut F)
Given two slices of equal length &u32 indices, looks up each one and calls the user given function on assembled u8x16 results.
- lookup_table1 (slice) is used for the first slice
- lookup_table2 (FxHashMap) is used for the second slice
- Table2 is only looked up if table1 returns a non-zero value
- The user function is passed (lookedup_values1: u8x16, lookedup_values2: u8x16, num_bytes)