Skip to content

⚡ Bolt: Optimize PassManager to eliminate redundant .clone() allocations - #19

Merged
Tcode-Motion merged 2 commits into
mainfrom
no-clones-optimizer-4831851234818099068
Aug 18, 2026
Merged

⚡ Bolt: Optimize PassManager to eliminate redundant .clone() allocations#19
Tcode-Motion merged 2 commits into
mainfrom
no-clones-optimizer-4831851234818099068

Conversation

@Tcode-Motion

Copy link
Copy Markdown
Owner

⚡ Bolt: Optimizer .clone() Removal

💡 What:

Removed redundant .clone() operations in the techscript_optimizer crate, specifically within:

  • PassManager::run stat tracking
  • pipeline.rs execution loops
  • dead_code.rs Use-Def analysis maps

🎯 Why:

The compiler was deeply copying complex Intermediate Representation (IR) data structures and statistics maps during every iteration of its optimization loops. By passing references and utilizing move semantics instead of deep copies, we eliminate substantial heap allocations and CPU overhead on the hot path.

📊 Expected Impact:

Significant reduction in memory allocations during the IR optimization phase, leading to faster compiler execution times.

🔬 Measurement & Verification:

  • Ran cargo check -p techscript_optimizer and confirmed the changes are type-safe and borrow-checker approved.
  • ⚠️ Note: The global workspace cargo test is currently broken due to pre-existing dependency rot in the techscript_stdlib crate (specifically failing bindings and trait bounds for ureq, digest, sha1, and libsqlite3-sys). Following established guidelines, these dependency issues have been explicitly isolated and left untouched to prevent scope creep in this performance-focused PR.
  • Added a Bolt learning log entry to .jules/bolt.md documenting this dependency isolation strategy.

PR created automatically by Jules for task 4831851234818099068 started by @Tcode-Motion

💡 What: Removed unnecessary `.clone()` operations from the `PassManager` configuration logic, the optimization `pipeline` loops, and the Use-Def maps in the `dead_code` optimization pass.
🎯 Why: Deep copying complex Intermediate Representation (IR) structures and block dependency graphs on every single compiler pass wastes significant CPU cycles and creates severe memory allocation bottlenecks.
📊 Impact: Expected to reduce memory footprint during IR compilation by eliminating redundant heap allocations, resulting in measurably faster build times for large TechScript sources.
🔬 Measurement: Verified type soundness and ownership correctness via `cargo check -p techscript_optimizer`. Note: The global workspace test suite currently fails due to pre-existing dependency incompatibilities within the `techscript_stdlib` crate (e.g. `ureq`, `sha1`, `libsqlite3-sys` changes); this PR intentionally scopes itself purely to the compiler optimization task to avoid unmanageable scope creep.

Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@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.

@Tcode-Motion
Tcode-Motion marked this pull request as ready for review August 18, 2026 16:19
@Tcode-Motion
Tcode-Motion merged commit c8609da into main Aug 18, 2026
3 of 6 checks passed
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.

1 participant