- Decode the dictionary once per block open into one DictEntry
{ start: u16, len: u16 } per token, instead of an offsets Vec checked
by validate_safety. DictEntry is repr(C, align(4)), with the layout of
a u32, checked by compile-time asserts. The reader enforces
MAX_CODE_BITS = 12, so token starts fit on 16 bits, and only the last
token's read padding is checked. The token lengths are decoded 16 at a
time with NEON (aarch64) or SSE2 (x86_64), which store the interleaved
(start, len) u16 lanes directly as DictEntry values, with a scalar loop
for the rest and for other targets.
- Decode values in a single pass: 4 codes per u64 load, one range check
per 4 codes, and a 16-byte over-copy per token, in chunks of 256 codes
so that reserve stays bounded. This drops onpair's decoded_len pre-pass
and the codes_buffer round trip. The code load (load_codes) and the
token copy (copy_token) are inline functions taking slices, with their
safety contracts checked by debug_assert.
- Remove the now unused codes_buffer parameter of append_value, and the
PlainValueReader field.
- Keep a single OwnedBytes in OnPair16Block instead of splitting it.
- Test write_codes against load_codes, the reader's code load, for
code_bits in 1..=12, instead of against BitUnpacker.
Co-authored-by: Paul Masurel <paul.masurel@datadoghq.com>
u32_to_i32_avx2, compact and compute_filter_bitset only use AVX2 intrinsics
on values, with no pointers. Since Rust 1.86, a #[target_feature] fn can be
safe, and calling it from a context with the same feature needs no unsafe
block. u32_to_i32_avx2 also gains its missing #[target_feature(enable = "avx2")].
The unsafe blocks in filter_vec_avx2_aux now only cover the pointer
load, store and offsets.
On 32-bit targets, the usize bound computation could wrap. The range check
then passed and the fast path read out of bounds. In u64, it cannot
overflow. On 64-bit targets, the generated code is the same.
Use scalar decoding for ranges overlapping the final partial load.
Clarify the 64-value aggregation block specialization and name the
generic decoding chunk size.
Apply nightly formatting to the touched benchmark and columnar code.
* Add filter_vec benchmarks (dense, sparse, full coverage)
Uses get_ids_for_value_range to exercise both the bitpacking decode and
the filter_vec SIMD path together under realistic cache conditions.
* Add NEON and SVE implementations for filter_vec
Adds aarch64-specific SIMD paths (NEON always available on aarch64;
SVE gated on nightly + non-Apple target) with routing logic in mod.rs
that selects the best available instruction set at runtime.
* Using asm! to workaround the lack of stabilized SVE intrinsics
* showing instruction set
* improved proptesting
* removing build.rs
---------
Co-authored-by: Paul Masurel <paul.masurel@datadoghq.com>
use usize in bitpacker to enable larger columns in the columnar store
Godbolt comparison with u32 vs u64 for get access: https://godbolt.org/z/cjf7nenYP
Add a mini-tool to inspect columnar files created by tantivy. (very basic functionality which can be extended later)
* add method to fetch block of first vals in columnar
add method to fetch block of first vals in columnar (this is way faster
than single calls for full columns)
add benchmark
fix import warnings
```
test bench_get_block_first_on_full_column ... bench: 56 ns/iter (+/- 26)
test bench_get_block_first_on_full_column_single_calls ... bench: 311 ns/iter (+/- 6)
test bench_get_block_first_on_multi_column ... bench: 378 ns/iter (+/- 15)
test bench_get_block_first_on_multi_column_single_calls ... bench: 546 ns/iter (+/- 13)
test bench_get_block_first_on_optional_column ... bench: 291 ns/iter (+/- 6)
test bench_get_block_first_on_optional_column_single_calls ... bench: 362 ns/iter (+/- 8)
```
* use remainder
* Do some Clippy- and Cargo-related boy-scouting.
* Add BytesFilterCollector to support filtering based on a bytes fast field
This is basically a copy of the existing FilterCollector but modified and
specialised to work on a bytes fast field.
* Changed semantics of filter collectors to consider multi-valued fields
* Faster range queries
This PR does several changes
- ip compact space now uses u32
- the bitunpacker now gets a get_batch function
- we push down range filtering, removing GCD / shift in the bitpacking
codec.
- we rely on AVX2 routine to do the filtering.
* Apply suggestions from code review
* Apply suggestions from code review
* CR comments
* Improvement on the scalar / random bitpacker code.
Added proptesting
Added simple benchmark
Added assert and comments on the very non trivial hidden contract
Remove the need for an extra padding.
The last point introduces a small performance regression (~10%).
* Fixing unit tests