andygrove opened a new pull request, #23589:
URL: https://github.com/apache/datafusion/pull/23589

   > This PR was created by an LLM as a draft PR. I will mark it as ready for 
review after human review.
   
   
   ## Which issue does this PR close?
   
   N/A — autonomous exploratory PR.
   
   ## Rationale for this change
   
   Added a scalar from/to fast path to string `replace` that hoists a 
memmem::Finder out of the per-row loop and skips materializing scalar args into 
N-element arrays, avoiding per-row searcher construction for the common 
replace(col,'lit','lit') pattern.
   
   ## What changes are included in this PR?
   
   Added a scalar from/to fast path to string `replace` that hoists a 
memmem::Finder out of the per-row loop and skips materializing scalar args into 
N-element arrays, avoiding per-row searcher construction for the common 
replace(col,'lit','lit') pattern.
   
   ## Are these changes tested?
   
   Correctness: unit tests + seeded differential fuzz (bit-identical Arrow 
output vs `main`).
   
   Benchmark (criterion):
   
   - replace_scalar from=_ab_ [size=8192, str_len=64]: 58.573% faster (base 
226815ns -> cand 93963ns)
   - replace_scalar from=_the_ [size=8192, str_len=16]: 30.039% faster (base 
155601ns -> cand 108860ns)
   - replace_scalar from=_ab_ [size=8192, str_len=32]: 50.571% faster (base 
174020ns -> cand 86017ns)
   - replace_scalar from=_ab_ [size=8192, str_len=16]: 10.673% faster (base 
135489ns -> cand 121028ns)
   - replace_scalar from=_the_ [size=8192, str_len=32]: 52.7% faster (base 
184286ns -> cand 87167ns)
   - replace_scalar from=_the_ [size=8192, str_len=64]: 60.147% faster (base 
227922ns -> cand 90834ns)
   
   Full criterion output:
   
   ```text
   replace_scalar from="ab" [size=8192, str_len=16]
                           time:   [120.76 µs 120.96 µs 121.15 µs]
                           change: [−10.856% −10.673% −10.491%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 12 outliers among 100 measurements (12.00%)
     12 (12.00%) low mild
   
   replace_scalar from="the" [size=8192, str_len=16]
                           time:   [108.51 µs 108.62 µs 108.73 µs]
                           change: [−30.131% −30.039% −29.950%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 2 outliers among 100 measurements (2.00%)
     2 (2.00%) low mild
   
   replace_scalar from="ab" [size=8192, str_len=32]
                           time:   [85.876 µs 85.955 µs 86.065 µs]
                           change: [−50.687% −50.571% −50.449%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 4 outliers among 100 measurements (4.00%)
     1 (1.00%) high mild
     3 (3.00%) high severe
   
   replace_scalar from="the" [size=8192, str_len=32]
                           time:   [87.137 µs 87.175 µs 87.225 µs]
                           change: [−52.797% −52.700% −52.610%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 5 outliers among 100 measurements (5.00%)
     2 (2.00%) low severe
     1 (1.00%) low mild
     2 (2.00%) high severe
   
   replace_scalar from="ab" [size=8192, str_len=64]
                           time:   [93.795 µs 93.907 µs 94.016 µs]
                           change: [−58.641% −58.573% −58.502%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 18 outliers among 100 measurements (18.00%)
     4 (4.00%) low severe
     5 (5.00%) low mild
     4 (4.00%) high mild
     5 (5.00%) high severe
   
   replace_scalar from="the" [size=8192, str_len=64]
                           time:   [90.843 µs 90.891 µs 90.957 µs]
                           change: [−60.277% −60.147% −60.021%] (p = 0.00 < 
0.05)
                           Performance has improved.
   Found 9 outliers among 100 measurements (9.00%)
     2 (2.00%) low severe
     3 (3.00%) low mild
     2 (2.00%) high mild
     2 (2.00%) high severe
   ```
   
   
   ## Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api 
change` label.
   -->
   


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