Skip to content

Commit

Permalink
Use Buffer::from_slice_ref which will be faster as it doesn't iterate…
Browse files Browse the repository at this point in the history
… through the slice.
  • Loading branch information
HawaiianSpork committed Nov 27, 2024
1 parent e6731b5 commit 7959fac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arrow-ipc/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ fn reencode_offsets<O: OffsetSizeTrait>(
let end_offset = offset_slice.last().unwrap();

let offsets: Buffer = match start_offset.as_usize() {
0 => offset_slice.iter().copied().collect(),
0 => Buffer::from_slice_ref(offset_slice),
_ => offset_slice.iter().map(|x| *x - *start_offset).collect(),
};

Expand Down

0 comments on commit 7959fac

Please sign in to comment.