diff --git a/fastfield_codecs/src/blockwise_linear.rs b/fastfield_codecs/src/blockwise_linear.rs index dbe70a0996..4207a8d32c 100644 --- a/fastfield_codecs/src/blockwise_linear.rs +++ b/fastfield_codecs/src/blockwise_linear.rs @@ -170,15 +170,18 @@ impl Column for BlockwiseLinearReader { interpoled_val.wrapping_add(bitpacked_diff) } + #[inline(always)] fn min_value(&self) -> u64 { // The BlockwiseLinearReader assumes a normalized vector. 0u64 } + #[inline(always)] fn max_value(&self) -> u64 { self.normalized_header.max_value } + #[inline(always)] fn num_vals(&self) -> u32 { self.normalized_header.num_vals } diff --git a/fastfield_codecs/src/linear.rs b/fastfield_codecs/src/linear.rs index 89851c7d9b..c68689c062 100644 --- a/fastfield_codecs/src/linear.rs +++ b/fastfield_codecs/src/linear.rs @@ -24,13 +24,13 @@ impl Column for LinearReader { interpoled_val.wrapping_add(bitpacked_diff) } - #[inline] + #[inline(always)] fn min_value(&self) -> u64 { // The LinearReader assumes a normalized vector. 0u64 } - #[inline] + #[inline(always)] fn max_value(&self) -> u64 { self.header.max_value } diff --git a/fastfield_codecs/src/monotonic_mapping.rs b/fastfield_codecs/src/monotonic_mapping.rs index 90affe2a25..4c686640f5 100644 --- a/fastfield_codecs/src/monotonic_mapping.rs +++ b/fastfield_codecs/src/monotonic_mapping.rs @@ -57,10 +57,12 @@ impl From for StrictlyMonotonicMappingInverter { impl StrictlyMonotonicFn for StrictlyMonotonicMappingInverter where T: StrictlyMonotonicFn { + #[inline(always)] fn mapping(&self, val: To) -> From { self.orig_mapping.inverse(val) } + #[inline(always)] fn inverse(&self, val: From) -> To { self.orig_mapping.mapping(val) } @@ -83,10 +85,12 @@ impl StrictlyMonotonicFn for StrictlyMonotonicMappingToInternal where T: MonotonicallyMappableToU128 { + #[inline(always)] fn mapping(&self, inp: External) -> u128 { External::to_u128(inp) } + #[inline(always)] fn inverse(&self, out: u128) -> External { External::from_u128(out) } @@ -96,10 +100,12 @@ impl StrictlyMonotonicFn for StrictlyMonotonicMappingToInternal where T: MonotonicallyMappableToU64 { + #[inline(always)] fn mapping(&self, inp: External) -> u64 { External::to_u64(inp) } + #[inline(always)] fn inverse(&self, out: u64) -> External { External::from_u64(out) } @@ -127,11 +133,13 @@ impl StrictlyMonotonicMappingToInternalGCDBaseval { impl StrictlyMonotonicFn for StrictlyMonotonicMappingToInternalGCDBaseval { + #[inline(always)] fn mapping(&self, inp: External) -> u64 { self.gcd_divider .divide(External::to_u64(inp) - self.min_value) } + #[inline(always)] fn inverse(&self, out: u64) -> External { External::from_u64(self.min_value + out * self.gcd) } @@ -142,6 +150,7 @@ pub(crate) struct StrictlyMonotonicMappingToInternalBaseval { min_value: u64, } impl StrictlyMonotonicMappingToInternalBaseval { + #[inline(always)] pub(crate) fn new(min_value: u64) -> Self { Self { min_value } } @@ -150,20 +159,24 @@ impl StrictlyMonotonicMappingToInternalBaseval { impl StrictlyMonotonicFn for StrictlyMonotonicMappingToInternalBaseval { + #[inline(always)] fn mapping(&self, val: External) -> u64 { External::to_u64(val) - self.min_value } + #[inline(always)] fn inverse(&self, val: u64) -> External { External::from_u64(self.min_value + val) } } impl MonotonicallyMappableToU64 for u64 { + #[inline(always)] fn to_u64(self) -> u64 { self } + #[inline(always)] fn from_u64(val: u64) -> Self { val } @@ -196,10 +209,12 @@ impl MonotonicallyMappableToU64 for bool { // TODO remove me. // Tantivy should refuse NaN values and work with NotNaN internally. impl MonotonicallyMappableToU64 for f64 { + #[inline(always)] fn to_u64(self) -> u64 { common::f64_to_u64(self) } + #[inline(always)] fn from_u64(val: u64) -> Self { common::u64_to_f64(val) } diff --git a/fastfield_codecs/src/null_index/sparse.rs b/fastfield_codecs/src/null_index/sparse.rs index fe08a07a79..a573cd379e 100644 --- a/fastfield_codecs/src/null_index/sparse.rs +++ b/fastfield_codecs/src/null_index/sparse.rs @@ -58,6 +58,7 @@ enum SparseCodecBlockVariant { impl SparseCodecBlockVariant { /// The number of non-null values that preceeded that block. + #[inline] fn offset(&self) -> u32 { match self { SparseCodecBlockVariant::Empty { offset } => *offset, diff --git a/fastfield_codecs/src/serialize.rs b/fastfield_codecs/src/serialize.rs index 0c2e6dff9f..2c42390ffb 100644 --- a/fastfield_codecs/src/serialize.rs +++ b/fastfield_codecs/src/serialize.rs @@ -202,6 +202,7 @@ pub enum ValueIndexInfo<'a> { SingleValue(Box), } +// TODO Remove me impl Default for ValueIndexInfo<'static> { fn default() -> Self { struct Dummy {}