You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "liamzwbao (via GitHub)" <gi...@apache.org> on 2025/07/23 03:17:15 UTC
Re: [I] Consider using `Vec` directly in builders [arrow-rs]
liamzwbao commented on issue #7383:
URL: https://github.com/apache/arrow-rs/issues/7383#issuecomment-3105523896
Hi @alamb and @Dandandan, I'm looking into this issue and wanted to clarify what you meant by "using `Vec` directly." From what I see, the code is already using a `Vec`, so I assume you're suggesting a refactor like this:
```rust
let mut intermediate = Vec::with_capacity(offsets.len() - 1);
for &offset in &offsets[1..] {
intermediate.push(offset + shift);
}
```
to use extend
```rust
let mut intermediate = Vec::with_capacity(offsets.len() - 1);
intermediate.extend(offsets[1..].iter().map(|&offset| offset + shift));
```
so that the code is more concise and the performance may improve.
Am I right? Thanks!
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org