Dandandan commented on pull request #9692:
URL: https://github.com/apache/arrow/pull/9692#issuecomment-798773979


   > > In general, &Vec and &String are anti patterns though, and some 
functions taking Vec and String still could/should be using references instead.
   > 
   > Yeah, I think it's always better to use `&[]` instead of `&Vec` and `&str` 
instead of `&String`.
   > 
   > In case of `Vec` v.s. `&[]`, I think it largely depends on the clone 
overhead. For example, if the function doesn't do any clone at all internally, 
then we should definitely pass in `&[]` instead of an owned `Vec`. If there is 
a decent amount of clone overhead, then it's better to manage the clone on 
callsite.
   
   Exactly, this is my current understanding too. It is best to evaluate on a 
case by case basis 👍


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