⚡ optimize find search index filtering loops and string allocations - #64
Conversation
Pre-compute lowercased shape and fallback texts during search index slide creation from OOXML and lazily populate them if missing. Replace array .filter() with direct loop iteration in collectFindMatchesFromSearchIndex to eliminate intermediate array allocations and repeated toLocaleLowerCase() string allocations on every query.
|
👋 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. |
Pre-compute lowercased shape and fallback texts during search index slide creation from OOXML and lazily populate them if missing. Replace array .filter() with direct loop iteration in collectFindMatchesFromSearchIndex to eliminate intermediate array allocations and repeated toLocaleLowerCase() string allocations on every query.
💡 What
Pre-computes lowercased shape text (
lowerShapeTexts) and fallback text (lowerFallbackText) when building PowerPoint find search index slides from OOXML (createFindSearchIndexSlideFromOoxml) and lazily populates them if missing. Replaces intermediate array.filter()calls insidecollectFindMatchesFromSearchIndexwith a direct single-passforloop.🎯 Why
Previously,
collectFindMatchesFromSearchIndexinvokedslide.shapeMatches.filter(...)on every slide for every search query keypress, callingtext.toLocaleLowerCase()on every shape text repeatedly and allocating intermediate filter arrays.📊 Measured Improvement
Benchmarked over a 200-slide deck (30 shapes per slide, 3,000 queries total):
PR created automatically by Jules for task 3420028259822040060 started by @MarsLuay