Skip to content

⚡ Bolt: [performance improvement] Precompute lowercase strings in todo-tracking#94

Draft
raccioly wants to merge 1 commit intomainfrom
bolt-optimize-todo-tracking-2707253010487627082
Draft

⚡ Bolt: [performance improvement] Precompute lowercase strings in todo-tracking#94
raccioly wants to merge 1 commit intomainfrom
bolt-optimize-todo-tracking-2707253010487627082

Conversation

@raccioly
Copy link
Copy Markdown
Owner

@raccioly raccioly commented May 8, 2026

💡 What:
Optimized the checkUntrackedTodos validator inside cli/validators/todo-tracking.mjs. The content of tracking documents is now converted to lowercase once when the file is initially loaded, rather than being redundantly lowercased inside a .some() loop for every single TODO comment found in the project.

🎯 Why:
Previously, if the project contained N TODO items and M tracking documents, the entire contents of the tracking documents were lowercased N * M times. For large documentation files (like ARCHITECTURE.md or ROADMAP.md) and a codebase with hundreds of TODOs, this created a significant and unnecessary CPU bottleneck during string allocation.

📊 Impact:
Substantially reduces string allocations and garbage collection overhead during the todo-tracking validation phase. The time complexity for the text preparation phase drops from $O(N \times M)$ to $O(M)$.

🔬 Measurement:
Run node --test tests/*.test.mjs to verify functionality remains unchanged. You can benchmark the overall CLI speed improvements on large projects by running time docguard guard before and after this change.


PR created automatically by Jules for task 2707253010487627082 started by @raccioly

Precomputes the lowercase version of the file content during the initial file load in `loadTrackingDocs` instead of dynamically lowering the string for every document inside the nested loop of `checkUntrackedTodos`. This eliminates significant overhead when scanning large codebases with many TODOs.

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

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