Skip to content

⚡ Bolt: [performance improvement] Prevent list materialization in variable_level AST traversal - #155

Open
tachyon-beep wants to merge 3 commits into
mainfrom
bolt-optimize-ast-traversal-6756327243091457610
Open

⚡ Bolt: [performance improvement] Prevent list materialization in variable_level AST traversal#155
tachyon-beep wants to merge 3 commits into
mainfrom
bolt-optimize-ast-traversal-6756327243091457610

Conversation

@tachyon-beep

Copy link
Copy Markdown
Collaborator

💡 What: Changed _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 materializing them into lists.
🎯 Why: Eagerly materializing AST nodes into lists during deep recursive AST traversal creates unnecessary memory allocations and GC pressure.
📊 Impact: Reduces memory allocations during Level 2 taint analysis (which is a hot path).
🔬 Measurement: Observe lower memory usage and slightly faster execution times during large AST analysis workloads.


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

Modified `_assignment_callee` and `_collect_return_paths` to accept `Iterable[ast.AST]` and passed `ast.iter_child_nodes()` directly instead of materializing them into lists to reduce memory allocations during hot-path taint analysis.

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 19, 2026 16:37
@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 optimizes Level 2 taint analysis AST traversal by avoiding eager list(...) materialization during deep recursive walks, reducing allocation and GC overhead in a hot path.

Changes:

  • Updated _assignment_callee and _collect_return_paths to accept Iterable[ast.AST] rather than list[ast.AST].
  • Passed func_node.body and ast.iter_child_nodes(...) directly to traversal helpers instead of wrapping them in list(...).
  • Added a Jules “bolt” note documenting the performance guideline for future AST traversals.

Reviewed changes

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

File Description
src/wardline/scanner/taint/variable_level.py Removes eager list materialization in recursive AST traversals by switching helper signatures to Iterable and passing iterators directly.
.jules/bolt.md Documents the optimization rationale and a guideline to avoid list(ast.iter_child_nodes(...)) in hot-path traversals.

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

google-labs-jules Bot and others added 2 commits August 19, 2026 17:01
Modified `_assignment_callee` and `_collect_return_paths` to accept `Iterable[ast.AST]` and passed `ast.iter_child_nodes()` directly instead of materializing them into lists to reduce memory allocations during hot-path taint analysis.

Co-authored-by: tachyon-beep <544926+tachyon-beep@users.noreply.github.com>
Modified `_assignment_callee` and `_collect_return_paths` to accept `Iterable[ast.AST]` and passed `ast.iter_child_nodes()` directly instead of materializing them into lists to reduce memory allocations during hot-path taint analysis.

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