comphead commented on code in PR #4894:
URL: https://github.com/apache/datafusion-comet/pull/4894#discussion_r3564674328
##########
native/spark-expr/src/string_funcs/regexp_extract.rs:
##########
@@ -87,14 +87,22 @@ fn extract_array<O: OffsetSizeTrait>(
group_idx: usize,
) -> ArrayRef {
let mut builder = StringBuilder::with_capacity(array.len(),
array.value_data().len());
+ // Reuse a single set of capture locations across every row.
`Regex::captures`
+ // allocates a fresh location buffer on each call; `captures_read` fills
this
+ // preallocated buffer in place, so the per-row heap allocation is paid
only once.
+ let mut locations = regex.capture_locations();
Review Comment:
prob we can reuse `OptimizedRegex` ?
--
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]