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

   ## Which issue does this PR close?
   
   - Closes #20753.
   
   ## Rationale for this change
   
   This PR implements two mostly unrelated optimizations for `strpos`:
   
   1. When the needle is scalar, we can build a single `memmem::Finder` and use 
it to search each row of the haystack. It turns out that this is significantly 
faster than using `memchr`, and the cost of constructing the finder is cheap 
because it is amortized over the batch.
   2. We previously optimized strpos to use memchr for searching when both 
haystack and needle are ASCII (#20295). That was needlessly conservative: UTF-8 
is self-stabilizing, so it should be safe to use `memchr` to search for matches 
for any combination of ASCII and UTF-8 needle and haystack.
   
   With a scalar needle, this improves performance 
   
   ## What changes are included in this PR?
   
   * Improve SLT test coverage for `strpos`
   * Refactor and extend `strpos` benchmarks to cover the scalar case
   * Implement optimizations described above
   * Code cleanup and refactoring for the `strpos` implementation
   
   ## Are these changes tested?
   
   Yes; new test cases and benchmarks added.
   
   ## Are there any user-facing changes?
   
   No.
   


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