Skip to content

⚡ Bolt: Optimize AST traversal memory allocation - #139

Open
tachyon-beep wants to merge 1 commit into
mainfrom
bolt-optimize-ast-traversal-5512015946659352799
Open

⚡ Bolt: Optimize AST traversal memory allocation#139
tachyon-beep wants to merge 1 commit into
mainfrom
bolt-optimize-ast-traversal-5512015946659352799

Conversation

@tachyon-beep

Copy link
Copy Markdown
Collaborator

💡 What: Modified _collect_return_paths and _assignment_callee functions in src/wardline/scanner/taint/variable_level.py to accept Iterable[ast.AST] instead of list[ast.AST]. Also stopped using list() to eagerly evaluate ast.iter_child_nodes() to pass into the functions.
🎯 Why: Converting generator yields like ast.iter_child_nodes to lists eagerly uses unnecessary memory allocations, which can add up significantly during large ast analysis passes.
📊 Impact: Expected reduction in peak memory usage during taint analysis, especially for complex ASTs.
🔬 Measurement: Verify by running the full test suite and observing lower memory consumption during large codebase analysis.


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

Modified `_collect_return_paths` and `_assignment_callee` functions in `src/wardline/scanner/taint/variable_level.py` to accept `Iterable[ast.AST]` instead of `list[ast.AST]`. Also stopped using `list()` to eagerly evaluate `ast.iter_child_nodes()` to pass into the functions.
Converting generator yields like `ast.iter_child_nodes` to lists eagerly uses unnecessary memory allocations, which can add up significantly during large ast analysis passes.

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 8, 2026 16:49
@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 peak memory usage during taint analysis by avoiding eager materialization of AST child-node iterators, and by broadening internal traversal helper signatures to accept generic iterables.

Changes:

  • Updated _collect_return_paths and _assignment_callee to accept Iterable[ast.AST] rather than list[ast.AST].
  • Removed list(...) wrapping around func_node.body and ast.iter_child_nodes(...), passing iterables/generators directly.
  • Added a Jules “bolt” note documenting the optimization guidance for future changes.

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 Avoids eager list allocations during recursive AST traversal by accepting/pass-through iterables.
.jules/bolt.md Documents the project guidance to pass ast.iter_child_nodes directly to avoid allocations.

💡 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