⚡ Bolt: Extract typeScores from search loops to prevent memory allocation#32
⚡ Bolt: Extract typeScores from search loops to prevent memory allocation#32
Conversation
|
👋 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. |
Deploying schoolmap with
|
| Latest commit: |
5cd5127
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://30dd6059.schoolmap.pages.dev |
| Branch Preview URL: | https://jules-1294132155847344070-96.schoolmap.pages.dev |
There was a problem hiding this comment.
Pull request overview
Optimizes the search engine’s hot paths by hoisting a static type-priority map out of per-result loops, reducing repeated allocations during frequent search/fuzzySearch calls.
Changes:
- Moved type ranking weights into a module-level
TYPE_SCORESconstant used by bothsearchandfuzzySearch. - Converted module-scope
Map/Setbindings toconstwhere they are not reassigned. - Improved a bbox-loading warning log by including the caught error.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/utils/searchEngine.ts |
Reduces allocation pressure in search scoring and tightens module-scope immutability. |
.jules/bolt.md |
Records the optimization learning/action for future reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
💡 What: Extracted the
typeScoresconfiguration object from thesearchandfuzzySearchloop execution paths insrc/utils/searchEngine.tsto a module-level constantTYPE_SCORES. Also changedletdeclarations for maps and sets toconst.🎯 Why: The search engine functions were unnecessarily re-allocating the same static
typeScoresmapping object in memory for every iteration of a user's search query, causing garbage collection overhead.📊 Impact: Reduces memory allocation and garbage collection pressure during high-frequency fuzzy searches, leading to faster execution and more stable framerates for the user.
🔬 Measurement: Profile the application during typing in the search bar. Observe a reduction in object allocations inside the
searchandfuzzySearchexecution paths.PR created automatically by Jules for task 1294132155847344070 started by @dttdrv