⚡ Bolt: optimize technology detection path checks and allocations#459
⚡ Bolt: optimize technology detection path checks and allocations#459yacosta738 wants to merge 1 commit into
Conversation
- Refactor `CompiledConfigFileContentRules` to store pre-compiled `PathBuf`s instead of `String`s, eliminating repeated heap allocations during rule evaluation. - Implement depth-aware existence checks using `MAX_DISCOVER_DEPTH` (4) to skip redundant `fs::exists` syscalls for shallow paths already indexed in `metadata.paths`. - Optimize Gradle layout checks in `gather_content_scan_files` to use `Path::new` for existence testing. - These changes significantly reduce the CPU and I/O overhead of technology detection, especially in projects with complex catalog rules.
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughOptimizes technology detection by pre-compiling file path markers into ChangesTechnology Detection Performance Optimization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.agents/journal/bolt.md:
- Line 172: The journal contains year typos in the section headings: update the
heading "## 2025-05-27 - Depth-Aware Existence Checks and Rule Pre-Compilation"
to "## 2026-05-27" (keeping the rest of the title) and also fix the earlier
heading "## 2025-05-24" to "## 2026-05-24" so all dates align with the
surrounding 2026 entries; edit the markdown headings in .agents/journal/bolt.md
accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9e6b5554-6450-4482-b5d6-71aa8198f30f
📒 Files selected for processing (2)
.agents/journal/bolt.mdsrc/skills/detect.rs
| **Action:** Prefer iterator-based pattern matching over `Vec` collection when processing large numbers | ||
| of items in a loop. Use `Clone` bounds on iterators to support backtracking without re-allocation. | ||
|
|
||
| ## 2025-05-27 - Depth-Aware Existence Checks and Rule Pre-Compilation |
There was a problem hiding this comment.
Correct the journal entry date.
The entry is dated 2025-05-27, but the PR was created on 2026-06-11. Given the chronological context of surrounding entries (2026-05-20, 2026-05-21, 2026-05-22) and that the current date is June 2026, this should be 2026-05-27.
Additionally, line 163 shows ## 2025-05-24 which also appears to be a year typo and should likely be 2026-05-24.
📅 Proposed fix for date consistency
-## 2025-05-27 - Depth-Aware Existence Checks and Rule Pre-Compilation
+## 2026-05-27 - Depth-Aware Existence Checks and Rule Pre-CompilationAnd for line 163:
-## 2025-05-24 - Allocation-Free Path Glob Matching
+## 2026-05-24 - Allocation-Free Path Glob Matching📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ## 2025-05-27 - Depth-Aware Existence Checks and Rule Pre-Compilation | |
| ## 2026-05-27 - Depth-Aware Existence Checks and Rule Pre-Compilation |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.agents/journal/bolt.md at line 172, The journal contains year typos in the
section headings: update the heading "## 2025-05-27 - Depth-Aware Existence
Checks and Rule Pre-Compilation" to "## 2026-05-27" (keeping the rest of the
title) and also fix the earlier heading "## 2025-05-24" to "## 2026-05-24" so
all dates align with the surrounding 2026 entries; edit the markdown headings in
.agents/journal/bolt.md accordingly.
⚡ Bolt: optimize technology detection path checks and allocations
💡 What:
CompiledConfigFileContentRulesto store pre-compiledPathBufs instead ofStrings.MAX_DISCOVER_DEPTH.gather_content_scan_filesusingPath::new.🎯 Why:
The technology detection system evaluates over 111 technologies. Many rules specify shallow configuration markers (like
package.jsonorCargo.toml). Previously, the system was performing redundantfs::existssyscalls for these markers even though they were already present in themetadata.pathscache (which covers all files up to depth 4). Additionally, storing markers asStringforced a newPathBufallocation for every rule evaluation.📊 Impact:
fs::existssyscalls per detection run.PathBufallocations from the hot loop (evaluation) to the cold path (rule compilation).🔬 Measurement:
cargo test --all-features).metadata.pathspopulation logic.PR created automatically by Jules for task 1553060984072360262 started by @yacosta738