Skip to content

⚡ Bolt: [performance improvement] Pre-compute search strings to reduce GC pressure during filtering#58

Open
subsubl wants to merge 1 commit intomasterfrom
bolt-perf-precompute-search-strings-17884789438908899978
Open

⚡ Bolt: [performance improvement] Pre-compute search strings to reduce GC pressure during filtering#58
subsubl wants to merge 1 commit intomasterfrom
bolt-perf-precompute-search-strings-17884789438908899978

Conversation

@subsubl
Copy link
Copy Markdown
Owner

@subsubl subsubl commented Mar 9, 2026

💡 What:
Updated pages/index.vue to use the transform option in useFetch to pre-compute and store lowercased search strings (_searchName, _searchDesc) directly on the fetched app objects. The filteredApps computed property now utilizes these pre-computed strings instead of allocating new strings and calling .toLowerCase() on the fly during the filtering loop. A critical learning entry regarding this pattern was also added to .jules/bolt.md.

🎯 Why:
In Nuxt 3/Vue 3 applications handling larger data sets, performing expensive operations like string allocations (.toLowerCase()) or complex parsing inside reactive computed loops (e.g., list filtering) leads to significant Garbage Collection (GC) pressure and main thread blocking on every keystroke that triggers reactivity.

📊 Impact:
Reduces the time complexity inside the reactive computed loop from O(N * string_allocations) to pure O(N) string comparisons. This dramatically improves the UI responsiveness and reduces main thread blocking during user input when searching through the app directory.

🔬 Measurement:

  1. pnpm install
  2. pnpm build (ensures the application builds correctly without syntax errors)
  3. pnpm dev and verify search responsiveness in the UI is snappy and correct.

PR created automatically by Jules for task 17884789438908899978 started by @subsubl

- Pre-compute `_searchName` and `_searchDesc` during the `useFetch` transform to avoid O(N) string allocations during reactive computed filtering.
- Update `.jules/bolt.md` to document the performance pattern of pre-computing data for Vue reactive loops to avoid GC pressure.

Co-authored-by: subsubl <114085822+subsubl@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant