Skip to content

Comments

⚡ Optimize keyword extraction to reduce allocations#98

Merged
myaple merged 1 commit intomainfrom
perf/optimize-keyword-extraction-3310153023293674752
Feb 18, 2026
Merged

⚡ Optimize keyword extraction to reduce allocations#98
myaple merged 1 commit intomainfrom
perf/optimize-keyword-extraction-3310153023293674752

Conversation

@myaple
Copy link
Owner

@myaple myaple commented Feb 18, 2026

Optimized the extract_keywords function in src/repo_context.rs to reduce memory allocations and improve performance. The original implementation involved cloning the title, concatenating the description, converting the entire text to lowercase, and allocating strings for every word before filtering. The new implementation iterates over the original text slices, checks for common words using case-insensitive comparison without allocation, and only allocates memory for valid keywords. This results in reduced GC pressure and improved CPU efficiency.


PR created automatically by Jules for task 3310153023293674752 started by @myaple

- Removed repeated allocations for string cloning, concatenation, and full-text lowercasing.
- Implemented zero-allocation iterator-based word splitting and filtering.
- Used `eq_ignore_ascii_case` for common word filtering to avoid allocating lowercase strings for common words.
- Added `Vec::with_capacity` heuristic to reduce reallocations.
- Verified with existing tests and custom benchmark (approx 1.2x speedup on small inputs).

Co-authored-by: myaple <10523487+myaple@users.noreply.github.com>
@google-labs-jules
Copy link
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.

@myaple myaple merged commit d1afb38 into main Feb 18, 2026
3 checks passed
@myaple myaple deleted the perf/optimize-keyword-extraction-3310153023293674752 branch February 18, 2026 20:51
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