Skip to content

⚡ Bolt: [performance improvement] Avoid eager materialization of AST traversal generators - #161

Open
tachyon-beep wants to merge 1 commit into
mainfrom
bolt-avoid-eager-materialization-ast-generators-2187943419742031240
Open

⚡ Bolt: [performance improvement] Avoid eager materialization of AST traversal generators#161
tachyon-beep wants to merge 1 commit into
mainfrom
bolt-avoid-eager-materialization-ast-generators-2187943419742031240

Conversation

@tachyon-beep

Copy link
Copy Markdown
Collaborator

💡 What: Updated _assignment_callee and _collect_return_paths in src/wardline/scanner/taint/variable_level.py to accept Iterable[ast.AST] and passed ast.iter_child_nodes() directly instead of eagerly materializing it into lists. Passed func_node.body directly instead of list(func_node.body).
🎯 Why: Eagerly materializing generators like ast.iter_child_nodes() into lists causes unnecessary memory allocations and overhead, slowing down AST traversal.
📊 Impact: Reduces memory allocations and overhead during L2 taint analysis by lazily evaluating child nodes, making static analysis faster.
🔬 Measurement: Run the test suite and confirm it passes. Benchmark memory usage and execution time of the taint analysis pipeline.


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

…traversal generators

💡 What: Updated `_assignment_callee` and `_collect_return_paths` in `src/wardline/scanner/taint/variable_level.py` to accept `Iterable[ast.AST]` and passed `ast.iter_child_nodes()` directly instead of eagerly materializing it into lists. Passed `func_node.body` directly instead of `list(func_node.body)`.
🎯 Why: Eagerly materializing generators like `ast.iter_child_nodes()` into lists causes unnecessary memory allocations and overhead, slowing down AST traversal.
📊 Impact: Reduces memory allocations and overhead during L2 taint analysis by lazily evaluating child nodes, making static analysis faster.
🔬 Measurement: Run the test suite and confirm it passes. Benchmark memory usage and execution time of the taint analysis pipeline.

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 23, 2026 16:25
@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 unnecessary list allocations during AST traversal in the L2 taint analysis by updating helper functions to accept Iterable[ast.AST] and by passing ast.iter_child_nodes() / func_node.body directly instead of eagerly materializing them.

Changes:

  • Update _assignment_callee and _collect_return_paths to accept Iterable[ast.AST] and avoid list(...) wrappers around AST iterators.
  • Pass func_node.body directly (avoid copying the function body list) in return-taint / return-callee computation paths.
  • Minor formatting-only adjustments in a few tests and MCP/server/install files, plus a new .jules/bolt.md note documenting the learning.

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 Switch traversal helpers to Iterable and remove eager list(...) materialization for child-node traversal and function bodies.
src/wardline/mcp/server.py Formatting-only change to keep trust_packs merge logic on one line.
src/wardline/install/block.py Whitespace-only change (blank lines) around top-level definitions/constants.
tests/unit/mcp/test_server_trust_grants.py Formatting-only change in test fixture file write.
tests/unit/install/test_mcp_json.py Formatting-only changes (single-line json.dumps(...) call and function signature formatting).
tests/unit/install/test_doctor_pack_grants.py Formatting-only change to a test function signature layout.
.jules/bolt.md Adds a short note capturing the performance learning/action for AST generator materialization.

💡 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