⚡ Bolt: [performance improvement] Avoid eager list materialization in AST traversal - #156
⚡ Bolt: [performance improvement] Avoid eager list materialization in AST traversal#156tachyon-beep wants to merge 1 commit into
Conversation
… AST traversal Co-authored-by: tachyon-beep <544926+tachyon-beep@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
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_calleeand_collect_return_pathsto acceptIterable[ast.AST]and passast.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.
💡 What: Modify
_assignment_calleeand_collect_return_pathsinsrc/wardline/scanner/taint/variable_level.pyto acceptIterable[ast.AST]instead oflist[ast.AST]and remove eager materialization of generators likeast.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 testto 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