kazantsev-maksim opened a new pull request, #5042:
URL: https://github.com/apache/datafusion-comet/pull/5042

   ## Which issue does this PR close?
   
   - N/A
   
   ## Rationale for this change
   
   Optimize existing expression.
   
   ## What changes are included in this PR?
   
   - Introduced a thread_local! scratch buffer pool (LEVENSHTEIN_SCRATCH) that 
reuses pre-allocated vectors across row evaluations using .resize(). This 
completely eliminates heap allocations for distance matrices inside the 
processing loop while remaining strictly thread-safe.
   - Added an ASCII Fast-Path (s.is_ascii() && t.is_ascii()) to both 
levenshtein_distance and levenshtein_distance_with_threshold. When inputs 
consist entirely of ASCII characters, the functions operate directly on raw 
UTF-8 byte slices (&[u8]) with zero heap allocations, falling back to the full 
Unicode char path only when non-ASCII characters are present.
   
   ## How are these changes tested?
   
   Existing tests.
   
   Benchmark (criterion):
   
   <img width="626" height="274" alt="image" 
src="https://github.com/user-attachments/assets/acbf32eb-db07-410f-a2ad-e2891ad9976f";
 />
   
   


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