mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
6069d09b9d
Maintain one Templar for the lifetime of VariableManager, calling set_available_variables() prior to each use, enabling _get_filter()'s cache to function correctly. It does not seem possible for concurrent calls into one (non-copied) VariableManager instance, and so it need not be reentrant. If that became a requirement, serializing its or Templar's entry points would be fine, as it's so CPU-heavy other threads will only fight with it for the GIL anyway. Reduces _get_filters() runtime 91%, get_vars() runtime 19%, function call count 16%, overall runtime 10%. Tested aginst dummy load comprised of the 12 disabled steps of debops.auth with an inventory of 80 hosts, which stresses variable processing and task setup. Before: 7447296 function calls (7253994 primitive calls) in 32.611 seconds Ordered by: cumulative time ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 32.762 32.762 ansible-playbook:3(<module>) 1 0.007 0.007 31.733 31.733 ansible-playbook:21(<module>) ... 1371/971 0.671 0.000 21.332 0.022 manager.py:154(get_vars) ... 3044 0.315 0.000 5.166 0.002 __init__.py:295(_get_filters) After: 6252978 function calls (6059638 primitive calls) in 29.055 seconds Ordered by: cumulative time ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 29.218 29.218 ansible-playbook:3(<module>) 1 0.007 0.007 28.159 28.159 ansible-playbook:21(<module>) ... 1371/971 0.675 0.000 17.211 0.018 manager.py:154(get_vars) ... 3044 0.028 0.000 0.441 0.000 __init__.py:295(_get_filters) |
||
---|---|---|
.. | ||
__init__.py | ||
clean.py | ||
hostvars.py | ||
manager.py | ||
reserved.py |