Open mbirtwell opened 4 years ago
I implemented (1) removing the deepcopy from merge_recurse
and updating the usages where I think it's necessary to deepcopy before passing the argument in. It's definitely provided an improvement. At the moment I've made the minimal change. I think if I was to propose this for inclusion I'd change merge
to not return the result so that it's clearer that it's mutating the arguments. But would be interested in some feedback on this as an idea.
I'm having trouble when running highstates that target lots of machines that they all take a while to get going. It seems that they effectively all end up queuing for the master to generate their pillar. I did some profiling of pillar generation for the salt master and in some cases the pillar generation was taking 15 seconds. 8 seconds of which was the deepcopy at the start of
merge_recurse
. Two approaches to removing this deep copy occur to me:merge
is called seem to pass the only reference to a dictonary asobj_a
so that dictionary could be safely mutated. The downside of this is that all callers, which aren't safe would need to deepcopy obj_a themselves. So far I've identified merge and merge_all in salt.modules.slsutil and there's a path in building the pillar if the ext_pillar_first option is set that I think should still have one deepcopy.I'd be happy to take a punt at implementing either of these or if you have a better idea I'm all ears.