Mryange opened a new pull request, #64012:
URL: https://github.com/apache/doris/pull/64012

   ### What problem does this PR solve?
   
   `multi_search_all_positions` used to scan the same haystack once for every 
constant needle. This is expensive when the needle array is large.
   
   This PR adds `MultiStringSearcher` for the constant-needle path. It batches 
needles into a 2-byte ngram hash table, scans each haystack once per batch, and 
verifies full needle matches before writing the result. Short or unsupported 
needles still use the existing single-string searcher fallback, and the 
dynamic-needle path is unchanged.
   
   Benchmark result for 4096 rows, 1024-byte haystacks, and 64 constant needles:
   
   | Case | Old CPU time | New CPU time | Speedup |
   | --- | ---: | ---: | ---: |
   | NoHit | 37.23 ms | 0.84 ms | 44.4x |
   | RareHit | 46.20 ms | 0.94 ms | 49.0x |
   | LastNeedleHit | 46.21 ms | 1.18 ms | 39.2x |
   
   The benchmark host had high load and CPU scaling enabled, so the numbers are 
intended as relative performance evidence.
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


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