Repository navigation
Build arrays through non-generic constructors - #10737
robert3005 wants to merge 1 commit into
Conversation
The generic constructors of Constant, Primitive, Struct, Chunked and Decimal arrays called the generic Array::from_parts_unchecked and Array::try_from_parts directly. Each crate that called them compiled its own copy of the from_parts functions and of the full DynArrayData vtable for the encoding. The generic constructors now call a private non-generic function, so vortex-array compiles each vtable once. ScalarFn had the same problem because new_from_validated_slots was #[inline]; it is not inlined now. vortex-ffi release cdylib __text: 37,223,740 -> 36,613,308 bytes (-610 KB). Copies of the Constant vtable: 22 -> 1, Primitive: 17 -> 1. Signed-off-by: Robert Kruszewski <robert@spiraldb.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2193919 to
6b24a64
Compare
Merging this PR will degrade performance by 11.41%4 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
The generic constructors (
ConstantArray::new<S>,PrimitiveArray::{new, try_new, new_unchecked, empty}<T>,DecimalArray::{try_new, new_unchecked}<T>, and theimpl IntoIteratorconstructors ofStructArrayandChunkedArray) called the genericArray::from_parts_uncheckedandArray::try_from_partsdirectly. Each crate that called them monomorphized its own copy of those functions and of the fullDynArrayDatavtable for the encoding.The generic constructors now call a private, non-generic builder.
vortex-arraycompiles each vtable once, and other crates call it.ScalarFnhad the same problem becausenew_from_validated_slotswas#[inline], and it is not inlined now. The cost is one function call when an array is constructed.vortex-ffirelease cdylib (macOS arm64)__text