Skip to content

⚡ Bolt: Optimize KnowledgeGraph search and node filtering#281

Open
hadsern wants to merge 1 commit into
v2-foundationfrom
bolt-knowledge-graph-optimization-4897619608573371061
Open

⚡ Bolt: Optimize KnowledgeGraph search and node filtering#281
hadsern wants to merge 1 commit into
v2-foundationfrom
bolt-knowledge-graph-optimization-4897619608573371061

Conversation

@hadsern

@hadsern hadsern commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

💡 What: Pre-indexed nodes into a Map (nodeMap) and a pre-lowercased string array (searchableNodes) within the filtered useMemo block in KnowledgeGraph.tsx. This avoids repeatedly iterating the entire node list and allocating massive amounts of new toLowerCase() strings on every single keydown stroke.
🎯 Why: Filtering nodes array and continuously executing toLowerCase() strings inside array iterations causes heavy CPU pressure and UI typing lag when the user queries large node datasets within the component.
📊 Impact: Changing the text search loop to use pre-lowercased strings, and the specific exact-match node focus lookups to a Map provides an O(1) performance and drastically removes O(N) array-scanning overheads and repetitive garbage collection from the main thread during typing events.
🔬 Measurement: Verify optimization by interacting with the Filter/Find inputs in the KnowledgeGraph component and confirming no functional changes to search behavior but with eliminated toLowerCase string processing overheads.


PR created automatically by Jules for task 4897619608573371061 started by @hadsern

Co-authored-by: hadsern <5723837+hadsern@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 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