neilconway commented on code in PR #20328:
URL: https://github.com/apache/datafusion/pull/20328#discussion_r2801048926


##########
datafusion/functions/src/string/common.rs:
##########
@@ -149,7 +201,8 @@ fn string_view_trim<Tr: Trimmer>(args: &[ArrayRef]) -> 
Result<ArrayRef> {
                     if let (Some(src_str), Some(characters)) =
                         (src_str_opt, characters_opt)
                     {
-                        let pattern: Vec<char> = characters.chars().collect();
+                        pattern.clear();

Review Comment:
   This optimization is not really related to the focus of this PR. I can move 
it to a separate PR if required, but it seemed pretty straightforward to me 
(hoist the per-row allocation out of the loop and just reset the pattern buffer 
instead). Not covered by the benchmarks but shouldn't hurt anything.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to