jorgecarleitao edited a comment on pull request #9235:
URL: https://github.com/apache/arrow/pull/9235#issuecomment-763898758


   I made a mistake in benchmarking and have to retract my statement. I am 
really sorry for the noise. :(
   
   I mistakenly updated the wrong part of the code before running the bench.
   
   @mbrubeck , even though there is a small difference between the the two 
extends in the benches that you added, when used in a non-trivial operation 
(`arithmetic`), `collect` is about +65% slower than using 
`extend_from_trusted_len_iter`.
   
   This hints that the `extend_trusted_len_iter` does have a significant 
benefit, if anything at helping the compiler optimize out some code.
   
   what I am using for the final benches:
   
   ```bash
   git checkout 7bb2f3c13f0e652b01e3fecbee0ae32ff094f3e6
   cargo bench --bench arithmetic_kernels -- "add 512"
   git checkout cdbbc6f9d81d37216dc158177405529988fa0279
   cargo bench --bench arithmetic_kernels -- "add 512"
   ```
   
   The difference in code is 
   
   ```rust
       let values = left
           .values()
           .iter()
           .zip(right.values().iter())
           .map(|(l, r)| op(*l, *r));
       let mut buffer = MutableBuffer::new(0);
       unsafe { buffer.extend_from_trusted_len_iter(values) };
   ```
   
   to 
   
   ```rust
       let buffer = left
           .values()
           .iter()
           .zip(right.values().iter())
           .map(|(l, r)| op(*l, *r))
           .collect();
   ```
   
   IMO this is interesting by itself.
   


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to