Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only inspect one frame in depends decorator
Some very good background can be found on StackOverflow: * https://stackoverflow.com/questions/17407119/python-inspect-stack-is-slow I filed an issue about slow `inspect.stack()` in Python some time ago: * https://bugs.python.org/issue39643 Slow `inspect.stack()` is a problem, but it's not the problem in this case. The problem is that Salt asks Python to get a full blown stack with all the frames, but then discards everything but the second frame from the top. This is very wasteful, and it's much more economic to ask for the current frame and walk back once. Here's how long it takes to run `test.ping` with existing code: ``` $ time sudo salt-call --local test.ping local: True real 0m12.166s user 0m11.679s sys 0m0.499s ``` And this is how much better it gets with the proposed change: ``` $ time sudo salt-call --local test.ping local: True real 0m2.092s user 0m1.772s sys 0m0.336s ``` If you follow the advice from #48773 and disable `vmware` module, which is responsible for the most calls into inspect module, you won't get much better than that: ``` $ cat /etc/salt/minion disable_grains: - esxi disable_modules: - vsphere $ time sudo salt-call --local test.ping local: True real 0m2.006s user 0m1.671s sys 0m0.353s ``` Closes #48773.
- Loading branch information