Expand description
§IntegerArray Module- Mid-Level, Inner Typed Integer Array
Arrow-compatible, SIMD-aligned integer array optimised for analytical workloads.
§Overview
- Logical type: fixed-width signed/unsigned integers (
T: Integer). - Physical storage:
Buffer<T>(backed byVec64<T>for 64-byte alignment) plus optional bit-packed validity mask (Bitmask). - Usable standalone or as the numeric arm of higher-level enums (
NumericArray,Array). - Zero-copy friendly and integrates with Arrow FFI.
§Features
- Construction from slices,
Vec, orVec64, with optional null mask. - Mutation: push/set, bulk null insertion, resize.
- Iteration: safe and (optionally) parallel, via the
MaskedArraytrait surface. - Null handling: Arrow-style bitmask (
1 = valid,0 = null) with length validation.
§Usage Tips
Prefer function signatures with &[T] or generic T: Integer where possible to keep
callsites simple while remaining zero-copy compatible with IntegerArray.
§Performance Benchmarks
Benchmarks under examples/hotloop_benchmark_std compare construction + sum over 1000 elems,
averaged across 1000 runs on a 2024 Intel(R) Core(TM) Ultra 7 155H (22 logical CPUs, 32 GB RAM).
Averaged Results (1000 runs, size = 1000)
Vec<i64>(raw): avg = 0.131 µsIntegerArray(minarrow, direct): avg = 0.130 µsInt64Array(arrow-rs, struct): avg = 0.327 µsIntegerArray(minarrow, enum): avg = 2.494 µsInt64Array(arrow-rs, dynamic trait): avg = 3.283 µs
Build note: use --release for representative numbers; debug builds distort results.
Takeaways
- Direct
IntegerArraymatches rawVec<i64>while adding SIMD alignment + Arrow interop. - Enum dispatch adds modest overhead but remains faster than dynamic dispatch (arrow-rs).
- For (extreme) latency-sensitive paths, prefer direct
IntegerArray; otherwise differences are minor vs. real compute/system overhead.
Structs§
- Integer
Array - IntegerArray