[ https://issues.apache.org/jira/browse/ARROW-10274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17211853#comment-17211853 ]
Jorge Leitão commented on ARROW-10274: -------------------------------------- > Maybe we could directly write the arithmetic result to a mutable buffer and > prevent this redundant copy? Yes :) > [Rust] arithmetic without SIMD does unnecesary copy > --------------------------------------------------- > > Key: ARROW-10274 > URL: https://issues.apache.org/jira/browse/ARROW-10274 > Project: Apache Arrow > Issue Type: Improvement > Components: Rust > Reporter: Ritchie > Priority: Minor > > The arithmetic kernels that don't use SIMD create a `vec` in memory and later > copy that data into a Buffer. Maybe we could directly write the arithmetic > result to a mutable buffer and prevent this redundant copy? > > > {code:java} > let values = (0..left.len()) > .map(|i| op(left.value(i), right.value(i))) > .collect::<Vec<T::Native>>(); > > > let data = ArrayData::new( > T::get_data_type(), > left.len(), > None, > null_bit_buffer, > 0, > vec![Buffer::from(values.to_byte_slice())], > vec![], > );{code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)