⚡ Bolt: optimize substring_by_char kernel#27
Conversation
…ent traversal This patch optimizes the `substring_by_char` kernel in the `arrow-string` crate by: 1. Adding an `is_ascii` fast path that uses O(1) byte-based indexing when possible. 2. Removing a redundant O(N) `chars().count()` pass. 3. Implementing efficient backward traversal for negative `start` indices. Performance impact: ~56% speedup for ASCII strings in benchmarks. Correctness verified with existing and new tests. Co-authored-by: Dandandan <163737+Dandandan@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What: Optimized
substring_by_charinarrow-string. Addedis_asciifast path, removed redundantchars().count()call, and added efficient backward traversal for negativestartindices.🎯 Why: The original implementation was doing at least two passes over every string (one for counting characters, one or more for finding offsets), which is inefficient, especially for common ASCII strings.
📊 Impact: Reduces
substring utf8 by charbenchmark time by ~56% for ASCII strings (from ~125ms to ~55ms). Also provides a speed boost for non-ASCII strings by avoiding one full pass.🔬 Measurement: Run
cargo bench -p arrow --bench substring_kernels --features="test_utils". Compare against a baseline established with the unmodified code.PR created automatically by Jules for task 4743308827040070461 started by @Dandandan