Rich-T-kid commented on issue #10868:
URL: https://github.com/apache/arrow-rs/issues/10868#issuecomment-5766296155

   ## `MutableBuffer` → `Vec<T>` Drop-in Replacement Candidates
   
   Scanned the codebase for write-heavy `MutableBuffer` usage where the only 
methods called (`push`, `extend_from_slice`, `resize`, `clear`, 
`from_len_zeroed`) have direct `Vec<T>` equivalents. Organized by crate and 
file below.
   
   ---
   
   ### `arrow-arith`
   
   | File | Lines | Methods Used | Replacement |
   |------|-------|-------------|-------------|
   | `src/arity.rs` | 393 | `new` + `push_unchecked` loop | `Vec<O::Native>` |
   
   ---
   
   ### `arrow-data`
   
   | File | Lines | Methods Used | Replacement |
   |------|-------|-------------|-------------|
   | `src/data.rs` | 101, 107, 118, 128 | `new` + `push` | `Vec<i32>` / 
`Vec<i64>` |
   | `src/transform/mod.rs` | 355 | `new` + `push` | `Vec<Offset>` |
   
   ---
   
   ### `arrow-ipc`
   
   | File | Lines | Methods Used | Replacement |
   |------|-------|-------------|-------------|
   | `src/reader.rs` | 960, 1887 | `try_from_len_zeroed` + `as_slice_mut` + 
`read_exact` / `try_resize` | `Vec<u8>` |
   | `src/reader.rs` | 3371, 3414, 3493 | `with_capacity` + `push(0_u8)` + 
`extend_from_slice` | `Vec<u8>` |
   | `src/writer.rs` | 2284, 2300 | `new` + `extend_from_slice` | `Vec<u8>` |
   
   ---
   
   ### `arrow-ord`
   
   | File | Lines | Methods Used | Replacement |
   |------|-------|-------------|-------------|
   | `src/comparison.rs` | 51, 92 | `try_from_len_zeroed` + `as_slice_mut` + 
`set_bit` | `Vec<u8>` |
   
   ---
   
   ### `arrow-row`
   
   | File | Lines | Methods Used | Replacement |
   |------|-------|-------------|-------------|
   | `src/fixed.rs` | 367, 368 | `new` + `push` loop | `Vec<u64>` |
   | `src/fixed.rs` | 457 | `new` + `extend_from_slice` loop + `as_slice_mut` | 
`Vec<u8>` |
   | `src/variable.rs` | 289 | `new` + `extend_from_slice` loop + 
`as_slice_mut` | `Vec<u8>` |
   | `src/variable.rs` | 332 | `new` + `extend_from_slice` loop + 
`get_unchecked_mut` | `Vec<u8>` |
   
   ---
   
   ### `arrow-select`
   
   | File | Lines | Methods Used | Replacement |
   |------|-------|-------------|-------------|
   | `src/concat.rs` | 310 | `with_capacity` + `push` loop | `Vec<OffsetSize>` |
   | `src/filter.rs` | 986, 995 | `with_capacity` + `extend_from_slice` loop | 
`Vec<u8>` |
   | `src/filter.rs` | 956 | `with_capacity` + `as_mut_ptr` + 
`ptr::copy_nonoverlapping` + `set_len` | `Vec<u8>` (unsafe, needs care) |
   | `src/interleave.rs` | 408 | `from_len_zeroed` + `as_slice_mut` + `set_bit` 
| `Vec<u8>` |
   | `src/take.rs` | 936 | `new` + `extend_from_slice` loop | `Vec<u8>` |
   | `src/take.rs` | 1156 | `from_len_zeroed` + `as_slice_mut` + 
`copy_from_slice` | `Vec<u8>` |
   | `src/zip.rs` | 542, 567, 607, 833 | `with_capacity` + 
`try_repeat_slice_n_times` | needs `try_repeat_slice_n_times` on `Vec` — not a 
clean drop-in |
   
   ---
   
   ### `arrow-string`
   
   | File | Lines | Methods Used | Replacement |
   |------|-------|-------------|-------------|
   | `src/concat_elements.rs` | 232 | `with_capacity` + `clear` + 
`try_extend_from_slice` x2 (reused temp buf) | `Vec<u8>` |
   | `src/substring.rs` | 375, 427 | `new` + `try_extend_from_slice` loop | 
`Vec<u8>` |
   
   ---
   
   **Notes:**
   - `src/zip.rs` sites use `try_repeat_slice_n_times`, which is a 
`MutableBuffer`-specific method with no `Vec` equivalent — skip or add a helper.
   - `src/filter.rs:956` uses raw pointer writes (`as_mut_ptr` + 
`copy_nonoverlapping` + `set_len`) — replaceable with `Vec<u8>` but requires 
the same unsafe block.
   - Everything else is a straightforward mechanical swap.


-- 
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