Skip to content

Comments

⚡ Optimize file search with concurrent fetching#97

Merged
myaple merged 2 commits intomainfrom
perf-concurrent-file-search-10613311397338644940
Feb 18, 2026
Merged

⚡ Optimize file search with concurrent fetching#97
myaple merged 2 commits intomainfrom
perf-concurrent-file-search-10613311397338644940

Conversation

@myaple
Copy link
Owner

@myaple myaple commented Feb 18, 2026

💡 What:

  • Replaced sequential get_file_content calls in FileIndexManager::search_files with concurrent execution using futures::future::join_all.
  • Added a new benchmark test src/tests/file_indexer_perf_test.rs using wiremock to simulate network latency and verify the performance improvement.

🎯 Why:

  • The previous implementation fetched file contents one by one. For a search result of 5 files (the limit), this meant the user had to wait for 5 sequential round-trips to the GitLab API.
  • This optimization allows all 5 requests to happen in parallel, reducing the total wait time to approximately the duration of the slowest single request.

📊 Measured Improvement:

  • Baseline (Sequential): ~518ms (for 5 files with 100ms simulated latency).
  • Optimized (Concurrent): ~110ms (for 5 files with 100ms simulated latency).
  • Speedup: ~4.7x faster.

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

Refactored `FileIndexManager::search_files` to fetch file contents concurrently using `futures::future::join_all`, replacing the sequential loop. This significantly reduces the total time for search operations involving multiple files.

Added a performance benchmark test `src/tests/file_indexer_perf_test.rs` which demonstrates a speedup from ~518ms to ~110ms for 5 files with 100ms latency.

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.

Refactored `FileIndexManager::search_files` to fetch file contents concurrently using `futures::future::join_all`, replacing the sequential loop. This significantly reduces the total time for search operations involving multiple files.

Added a performance benchmark test `src/tests/file_indexer_perf_test.rs` which demonstrates a speedup from ~518ms to ~110ms for 5 files with 100ms latency.

Also ran `cargo fmt`.

Co-authored-by: myaple <10523487+myaple@users.noreply.github.com>
@myaple myaple merged commit 0f840d5 into main Feb 18, 2026
3 checks passed
@myaple myaple deleted the perf-concurrent-file-search-10613311397338644940 branch February 18, 2026 20:54
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