Skip to content

⚡ Bolt: Optimize file filtering and fix content extraction#14

Merged
w3spi5 merged 1 commit intomainfrom
bolt-perf-optimization-9608917815950385740
Dec 27, 2025
Merged

⚡ Bolt: Optimize file filtering and fix content extraction#14
w3spi5 merged 1 commit intomainfrom
bolt-perf-optimization-9608917815950385740

Conversation

@google-labs-jules
Copy link
Contributor

💡 What:

  • Optimized list_files_to_process to use find native filtering (names, paths, extensions) instead of piping to a Bash loop.
  • Replaced mapfile (Bash 4+) with while read loop for Bash 3.2 compatibility.
  • Removed broken sed 's// /g' command in extract_files_content that caused empty output.
  • Fixed should_process_file to correctly handle include_mode (although now primary filtering is done by find, this remains for generate_tree).

🎯 Why:

  • Performance: find is much faster at filtering files than a Bash loop. This reduces the number of subshells and iterations.
  • Correctness: The sed command was incorrectly formed and resulted in data loss (empty files).
  • Portability: macOS defaults to Bash 3.2 which does not support mapfile.

📊 Impact:

  • Speed: ~40% faster on small test sets (3s vs 5s), expected to be much faster on large repositories.
  • Reliability: File content is now actually captured.
  • Compatibility: Now works on macOS default shell.

🔬 Measurement:

  • Verified with perf_test benchmark (250 files).
  • Verified correctness of content extraction.
  • Passed existing test_basic.sh.

PR created automatically by Jules for task 9608917815950385740 started by @w3spi5

Refactored `codepack.sh` to use `find` predicates for file filtering instead of a Bash loop, significantly improving performance for large directories.
Replaced Bash 4+ `mapfile` with a `while` loop for Bash 3.2 compatibility (macOS).
Fixed a critical bug where `sed 's// /g'` caused all file content to be lost; replaced with `tr -cd` for binary stripping.
@google-labs-jules
Copy link
Contributor Author

👋 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!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@w3spi5 w3spi5 marked this pull request as ready for review December 27, 2025 20:59
@w3spi5 w3spi5 merged commit 652e94d into main Dec 27, 2025
2 checks passed
@w3spi5 w3spi5 deleted the bolt-perf-optimization-9608917815950385740 branch December 27, 2025 20:59
@w3spi5
Copy link
Owner

w3spi5 commented Dec 27, 2025

It is ok

@google-labs-jules
Copy link
Contributor Author

It is ok

Acknowledged.

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