viirya commented on issue #12467:
URL: https://github.com/apache/arrow-rs/issues/12467#issuecomment-7172415844

   +1 on consolidating. A few points for the POC:
   
   - **`cmp_bytes` slow path:** I'd keep `memcmp` (`a[k..].cmp(&b[k..])`) for 
long shared prefixes instead of scanning with `common_prefix_len` and comparing 
the byte at the mismatch. #12460 added its 64-byte bound because a chunk loop 
lost to `memcmp` there (+22% on `large_string_non_null`, +26% on 
`small_string_shared_prefix`). The 32-byte block scan was only measured on 
aarch64, where widths from 16 up tie. Nothing shows it keeps up with glibc's 
AVX2 `memcmp`. Relatedly, #10549 and #12460 don't really conflict. One needs 
the mismatch position, which `memcmp` can't return. The other needs only the 
order. Both avoid a per-block out-of-line call.
   - **Bitmaps in a new crate:** parquet still can't reach `UnalignedBitChunk` 
without `arrow-buffer`. The popcount kernel (`count_ones_words`) would have to 
move into the new crate, with `arrow-buffer` delegating to it. parquet's 
`skip_and_count_ones` calls `count_set_bits` once per bit-packed run, often a 
short range. `UnalignedBitChunk::new`'s setup (`align_to`, prefix/suffix masks) 
needs a benchmark on short ranges before switching.
   - **Inlining across crates:** moving a primitive into another crate changes 
the inlining decisions #12460 measured within one crate. Each caller needs 
re-measuring, with LTO as well as without, since downstream users like 
DataFusion often enable it.
   - **What to make public:** I'd only add a primitive once it has two real 
callers. The `u64` `prefix_key` could wait until it does.
   - **#12460:** I wouldn't hold it for this. It can merge with private helpers 
and move once the shared home exists.
   - **VLQ panic:** separate from consolidation, `BitReader::get_vlq_int` can 
be triggered by a corrupt file. The RLE run header (`rle.rs:719`) and the 
`DELTA_BINARY_PACKED` headers read through it, so an overlong varint in page 
data panics instead of returning an error. That's worth its own fix now. A 
shared decoder shaped like avro's `read_varint(&[u8]) -> Option<(u64, usize)>` 
would let each crate map the failure to its own error type.
   - **Naming:** if byte comparison and VLQ land there too, `arrow-bitutils` 
may be too narrow a name.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to