diff --git a/Cargo.toml b/Cargo.toml index 8cf6e741a8b..c25c634eae5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -419,7 +419,3 @@ incremental = false debug = false debug-assertions = true incremental = false - -# This improved build times significantly for default common cases that we use locally -[profile.dev.package.vortex-fastlanes] -debug = false diff --git a/encodings/fastlanes/src/bitpacking/compute/compare.rs b/encodings/fastlanes/src/bitpacking/compute/compare.rs index d5c50751bae..d69e098c594 100644 --- a/encodings/fastlanes/src/bitpacking/compute/compare.rs +++ b/encodings/fastlanes/src/bitpacking/compute/compare.rs @@ -80,24 +80,43 @@ where + FastLanesComparable::Physical>, ::Physical: BitPacking + NativePType + BitPackingCompare, { - match operator { - CompareOperator::Eq => { - stream_compare_fused::(lhs, rhs, nullability, |a, b| a.is_eq(b), ctx) - } - CompareOperator::NotEq => { - stream_compare_fused::(lhs, rhs, nullability, |a, b| !a.is_eq(b), ctx) - } - CompareOperator::Lt => { - stream_compare_fused::(lhs, rhs, nullability, |a, b| a.is_lt(b), ctx) - } - CompareOperator::Lte => { - stream_compare_fused::(lhs, rhs, nullability, |a, b| a.is_le(b), ctx) - } - CompareOperator::Gt => { - stream_compare_fused::(lhs, rhs, nullability, |a, b| a.is_gt(b), ctx) - } - CompareOperator::Gte => { - stream_compare_fused::(lhs, rhs, nullability, |a, b| a.is_ge(b), ctx) + #[cfg(debug_assertions)] + { + // FastLanes expands `unchecked_unpack_cmp` by width, value type, and comparator type. + // In dev builds, using one function-pointer comparator type avoids multiplying that + // generated code and debug info by every comparison operator. + let cmp: fn(T, T) -> bool = match operator { + CompareOperator::Eq => T::is_eq, + CompareOperator::NotEq => T::is_ne, + CompareOperator::Lt => T::is_lt, + CompareOperator::Lte => T::is_le, + CompareOperator::Gt => T::is_gt, + CompareOperator::Gte => T::is_ge, + }; + stream_compare_fused:: bool>(lhs, rhs, nullability, cmp, ctx) + } + + #[cfg(not(debug_assertions))] + { + match operator { + CompareOperator::Eq => { + stream_compare_fused::(lhs, rhs, nullability, T::is_eq, ctx) + } + CompareOperator::NotEq => { + stream_compare_fused::(lhs, rhs, nullability, T::is_ne, ctx) + } + CompareOperator::Lt => { + stream_compare_fused::(lhs, rhs, nullability, T::is_lt, ctx) + } + CompareOperator::Lte => { + stream_compare_fused::(lhs, rhs, nullability, T::is_le, ctx) + } + CompareOperator::Gt => { + stream_compare_fused::(lhs, rhs, nullability, T::is_gt, ctx) + } + CompareOperator::Gte => { + stream_compare_fused::(lhs, rhs, nullability, T::is_ge, ctx) + } } } } diff --git a/vortex-array/src/dtype/ptype.rs b/vortex-array/src/dtype/ptype.rs index ab443618d66..e2565147ac3 100644 --- a/vortex-array/src/dtype/ptype.rs +++ b/vortex-array/src/dtype/ptype.rs @@ -152,6 +152,11 @@ pub trait NativePType: /// Whether another instance of this type (`other`) is bitwise equal to `self` fn is_eq(self, other: Self) -> bool; + /// Whether another instance of this type (`other`) is bitwise not equal to `self` + fn is_ne(self, other: Self) -> bool { + !self.is_eq(other) + } + /// Downcast the provided object to a type-specific instance. fn downcast(visitor: V) -> V::Output;