alamb opened a new issue, #9140:
URL: https://github.com/apache/arrow-rs/issues/9140
> we can probably avoid an additional allocation for sliced arrays by making
a version of `slice()` that consumes self -- like `sliced()` perhaps 🤔
_Originally posted by @alamb in
[#9114](https://github.com/apache/arrow-rs/pull/9114/changes#r2670379840)_
The idea is that calling `ArrayData::slice()` creates a *new* array data
(needs to allocate a Vec for the new child buffers). For some cases, the caller
owns the ArrayData and thus could simply reuse the allocation by taking it as
owned
Something like
```rust
impl ArrayData {
/// Like Self::sliced, but takes an owned self, and reuses the
allocations, making it more efficient
fn sliced(self, offset: usize, len: usize) -> Self {
...
}
}
```
--
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]