Skip to content

⚡ Bolt: Avoid eager materialization of AST child nodes - #136

Open
tachyon-beep wants to merge 1 commit into
mainfrom
bolt/ast-node-generator-optimization-7038201939160521137
Open

⚡ Bolt: Avoid eager materialization of AST child nodes#136
tachyon-beep wants to merge 1 commit into
mainfrom
bolt/ast-node-generator-optimization-7038201939160521137

Conversation

@tachyon-beep

Copy link
Copy Markdown
Collaborator

💡 What: Passing ast.iter_child_nodes generator directly into recursive functions instead of wrapping them in list() in src/wardline/scanner/taint/variable_level.py.
🎯 Why: Eagerly materializing AST node generators creates unnecessary memory allocations and performance overhead during deep or recursive AST traversals in taint tracking.
📊 Impact: Reduces memory allocations during recursive static analysis over AST nodes.
🔬 Measurement: Verify tests run successfully; observe memory profiling during deep AST scans if needed.


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

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 5, 2026 16:40

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 improves AST traversal performance in the taint-tracking scanner by avoiding eager list(...) materialization of ast.iter_child_nodes(...) during recursive descent.

Changes:

  • Updated recursive traversal helpers to accept Iterable[ast.AST] instead of list[ast.AST].
  • Replaced list(ast.iter_child_nodes(node)) with ast.iter_child_nodes(node) in recursive calls to reduce allocations.
  • Added a short “Bolt” note documenting the optimization guideline.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/wardline/scanner/taint/variable_level.py Switches recursive AST traversal to consume iterables/generators directly to avoid eager list allocations.
.jules/bolt.md Documents the performance learning/action for future AST traversal changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

nested = _assignment_callee(
list(ast.iter_child_nodes(node)), name, worst, function_taint, taint_map, var_taints
)
nested = _assignment_callee(ast.iter_child_nodes(node), name, worst, function_taint, taint_map, var_taints)
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