Skip to content

⚡ Bolt: [performance improvement] Optimize search filtering by pre-computing lowercase strings#64

Open
subsubl wants to merge 1 commit intomasterfrom
bolt-performance-search-optim-17530034577815287919
Open

⚡ Bolt: [performance improvement] Optimize search filtering by pre-computing lowercase strings#64
subsubl wants to merge 1 commit intomasterfrom
bolt-performance-search-optim-17530034577815287919

Conversation

@subsubl
Copy link
Copy Markdown
Owner

@subsubl subsubl commented Mar 15, 2026

💡 What

This optimization moves the generation of lowercase search strings (name and description) out of the reactive computed loop in pages/index.vue and into the transform function of the useFetch call.

🎯 Why

In Nuxt/Vue, reactive computed properties are re-evaluated entirely whenever their reactive dependencies (like the searchQuery) change. For the filteredApps computed property, this meant that iterating over the list of apps caused .toLowerCase() to be called on every app's name and description for every keystroke the user typed. This operation creates new string objects in memory on each iteration, leading to unnecessary CPU overhead and garbage collection pressure, which becomes a bottleneck as the list of apps grows.

By pre-computing these strings during the fetch stage (which happens once), the reactive loop only performs simple O(N) string comparisons without allocating new objects.

📊 Impact

  • Eliminates dynamic string allocations during search filtering.
  • Reduces CPU cycles spent on string transformation during UI rendering.
  • Results in a smoother search experience, particularly on low-end devices or when the dataset grows larger.
  • Safe optimization using Nuxt's idiomatic transform pattern.

🔬 Measurement

  1. Pull the changes.
  2. Run pnpm dev.
  3. Type rapidly into the search input. The CPU load and memory allocations profiled in DevTools will be lower compared to the original implementation due to the absence of repeated .toLowerCase() allocations.
  4. Verify the search logic still functions correctly (e.g., searching for "Gate" filters to "Gate Control").

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

…eFetch transform

Optimizes the `filteredApps` computed property in `pages/index.vue`. By pre-computing the lowercase `name` and `description` of each app once during the initial data fetch via Nuxt's `useFetch` `transform` option, we eliminate the need to repeatedly call `.toLowerCase()` on every app object during every reactive re-evaluation of the search filter. This reduces CPU overhead and dynamic string allocation garbage collection pressure, particularly on long lists.

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