andygrove commented on code in PR #12289:
URL: https://github.com/apache/arrow-rs/pull/12289#discussion_r4601591043
##########
arrow-row/src/variable.rs:
##########
@@ -217,6 +260,32 @@ fn encode_blocks<const SIZE: usize>(out: &mut [u8], val:
&[u8]) -> usize {
end_offset
}
+/// Copies `src` to the start of `dst`, which must be at least as long.
+///
+/// A value's last block is usually partial, and its length varies from row
+/// to row. `copy_from_slice` calls `memcpy` for a length the compiler can't
+/// see, and the call costs more than these few fixed-size copies. Each branch
+/// copies the first and the last bytes of `src`, which may overlap.
+#[inline]
+fn copy_short(dst: &mut [u8], src: &[u8]) {
Review Comment:
How does `copy_short` do on its own with random lengths? In the table the
clear gains for `Utf8` are `string(10)` and `string(30)`, where every value has
the same length, while `string(1..100)` and `string(1..40)` range from 0.91x to
1.49x. Could you run `copy_short` without the other two changes on the
random-length cases? If the gain holds there, great. If not, it might be
simpler to leave it out and keep this PR to the view loop and the strided path.
##########
arrow-row/src/lib.rs:
##########
@@ -1101,6 +1102,35 @@ impl RowConverter {
let write_offset = rows.num_rows();
let lengths = row_lengths(columns, &encoders);
+ if let LengthTracker::Fixed { length, num_rows } = lengths
Review Comment:
One thing stood out in the table. `53 columns` is 0.97x and 0.98x on
Neoverse-V2 in both the default and aligned runs, and since it agrees across
layouts it looks less like noise than the other low cases. That key never takes
the strided path. Could the cost come from the strided code being inlined into
`append`? Moving the `if let LengthTracker::Fixed` block into an
`#[inline(never)]` helper would keep `append` the size it was for mixed keys.
Could you try that and rerun `53 columns`?
--
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]