Skip to content

Conversation

@adolago
Copy link
Owner

@adolago adolago commented Feb 8, 2026

πŸ’‘ What: Optimized deep_merge to use in-place mutation instead of full structure cloning.
🎯 Why: deep_merge previously cloned the entire base serde_yaml::Value map at every level of recursion, even for keys that weren't being modified. This caused unnecessary memory allocation and copying, O(N) for every merge operation.
πŸ“Š Impact: significantly reduces memory allocations and copying overhead for variable merging, especially when hash_behaviour = merge is used or when merging deep structures.
πŸ”¬ Measurement: Validated with unit tests ensuring behavior remains identical to the original implementation.


PR created automatically by Jules for task 14665495014126406948 started by @dolagoartur

Implements `deep_merge_in_place` to avoid recursive cloning of the entire base structure during variable merging.
This significantly reduces memory allocations and copying overhead when merging large variable maps, especially with `HashBehaviour::Merge`.

- Adds `deep_merge_in_place` to `src/vars/mod.rs`
- Updates `deep_merge` to use the in-place implementation (backward compatible)
- Updates `VarStore::merge_value` to use `deep_merge_in_place` directly
- Adds unit tests for `deep_merge_in_place`

Co-authored-by: dolagoartur <146357947+dolagoartur@users.noreply.github.com>
@google-labs-jules
Copy link
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.

@adolago adolago merged commit 59ae123 into main Feb 11, 2026
20 of 23 checks passed
@adolago adolago deleted the bolt/optimize-deep-merge-14665495014126406948 branch February 11, 2026 09:15
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