Commit 917f20b
committed
Optimize SSH client grains updates to avoid OptsDict deepcopy
Replace nested grains mutations with dict merge operation in SSH
client cache restoration. This eliminates the last remaining grains
deepcopy triggers when using OptsDict.
Before:
for grain in conf_grains:
opts["grains"][grain] = conf_grains[grain] # Triggers DictProxy deepcopy
After:
grains_updates = {**conf_grains, **roster_grains}
opts["grains"] = {**opts["grains"], **grains_updates} # Single replacement
Benefits:
- Eliminates 100% of grains nested mutations (2/2 locations)
- No performance impact (same merge semantics)
- Makes grains/pillar handling 100% efficient with OptsDict
Related to OptsDict memory optimization work.1 parent 99c8b7f commit 917f20b
1 file changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1447 | 1447 | | |
1448 | 1448 | | |
1449 | 1449 | | |
1450 | | - | |
1451 | | - | |
1452 | | - | |
1453 | | - | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
1454 | 1454 | | |
1455 | | - | |
1456 | | - | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
1457 | 1459 | | |
1458 | 1460 | | |
1459 | 1461 | | |
| |||
0 commit comments