Skip to content

Comments

⚡ Optimize file content extraction performance#96

Merged
myaple merged 2 commits intomainfrom
perf/optimize-file-extraction-4761616264722925510
Feb 18, 2026
Merged

⚡ Optimize file content extraction performance#96
myaple merged 2 commits intomainfrom
perf/optimize-file-extraction-4761616264722925510

Conversation

@myaple
Copy link
Owner

@myaple myaple commented Feb 18, 2026

💡 What: Optimized extract_relevant_file_sections in src/repo_context.rs by changing the intermediate lines storage from Vec<String> to Vec<&str>, avoiding string allocation for every line in the file. Also hoisted the to_lowercase() call for keywords out of the inner loop to prevent repeated allocations.

🎯 Why: The previous implementation allocated a new String for every line in the file content, which is memory intensive for large files. It also re-allocated lowercased keywords for every line iteration.

📊 Measured Improvement:

  • Benchmark added in src/tests/repo_context_perf_test.rs.
  • Baseline: ~30.4ms for 100,000 lines.
  • Optimized: ~10.9ms for 100,000 lines.
  • ~3x performance improvement in extraction time.

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

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.

Co-authored-by: myaple <10523487+myaple@users.noreply.github.com>
@myaple myaple merged commit ec2b03d into main Feb 18, 2026
3 checks passed
@myaple myaple deleted the perf/optimize-file-extraction-4761616264722925510 branch February 18, 2026 21:02
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