⚡ Bolt: Optimize PassManager to eliminate redundant .clone() allocations - #19
Conversation
💡 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>
|
👋 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. |
⚡ Bolt: Optimizer
.clone()Removal💡 What:
Removed redundant
.clone()operations in thetechscript_optimizercrate, specifically within:PassManager::runstat trackingpipeline.rsexecution loopsdead_code.rsUse-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:
cargo check -p techscript_optimizerand confirmed the changes are type-safe and borrow-checker approved.cargo testis currently broken due to pre-existing dependency rot in thetechscript_stdlibcrate (specifically failing bindings and trait bounds forureq,digest,sha1, andlibsqlite3-sys). Following established guidelines, these dependency issues have been explicitly isolated and left untouched to prevent scope creep in this performance-focused PR..jules/bolt.mddocumenting this dependency isolation strategy.PR created automatically by Jules for task 4831851234818099068 started by @Tcode-Motion