Skip to content

⚡ Bolt: [performance improvement] Avoid eager list materialization in AST traversal - #156

Open
tachyon-beep wants to merge 1 commit into
mainfrom
bolt-perf-ast-iterators-759077334544298537
Open

⚡ Bolt: [performance improvement] Avoid eager list materialization in AST traversal#156
tachyon-beep wants to merge 1 commit into
mainfrom
bolt-perf-ast-iterators-759077334544298537

Conversation

@tachyon-beep

Copy link
Copy Markdown
Collaborator

💡 What: Modify _assignment_callee and _collect_return_paths in src/wardline/scanner/taint/variable_level.py to accept Iterable[ast.AST] instead of list[ast.AST] and remove eager materialization of generators like ast.iter_child_nodes().

🎯 Why: To avoid unnecessary list allocations and iterations during recursive AST traversal, reducing memory overhead and improving performance.

📊 Impact: Reduces memory allocations and iteration overhead for large/deep ASTs, improving overall traversal performance.

🔬 Measurement: Run make test to ensure no functionality is broken, and benchmark memory and speed across large projects.


PR created automatically by Jules for task 759077334544298537 started by @tachyon-beep

… AST traversal

Co-authored-by: tachyon-beep <544926+tachyon-beep@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.

Copilot AI lite review requested due to automatic review settings August 20, 2026 16:40
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces memory overhead in the taint scanner’s AST traversal by removing eager list(...) materialization and allowing traversal helpers to consume generic iterables directly, improving performance on large/deep ASTs.

Changes:

  • Update _assignment_callee and _collect_return_paths to accept Iterable[ast.AST] and pass ast.iter_child_nodes(...) directly.
  • Remove unnecessary list(func_node.body) materialization at call sites in return-taint/callee computation.
  • Minor formatting/whitespace adjustments in a few tests and MCP/server/install modules; add a brief Bolt learning note.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/wardline/scanner/taint/variable_level.py Avoids eager list allocations during recursive AST traversal by accepting iterables and passing generators through.
src/wardline/mcp/server.py Minor formatting change in trust-pack grant merge logic (no behavioral change).
src/wardline/install/block.py Whitespace-only spacing adjustments around top-level definitions.
tests/unit/mcp/test_server_trust_grants.py Minor formatting adjustment in test fixture project setup.
tests/unit/install/test_mcp_json.py Minor formatting adjustments in MCP JSON repair tests.
tests/unit/install/test_doctor_pack_grants.py Minor formatting adjustment in doctor pack grants tests.
.jules/bolt.md Documents the optimization rationale as a Bolt learning/action note.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants