Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Comparing each element of the static options with each incoming element is very inefficient. Since dictionaries are ordered this can be simplified to a simple key value insert. Prior to this change: ``` parse_static_options (/Users/mvandenb/src/galaxy/lib/galaxy/tool_util/parser/xml.py:1207) function called 7183 times 313317 function calls in 11.318 seconds Ordered by: cumulative time, internal time, call count ncalls tottime percall cumtime percall filename:lineno(function) 7183 11.281 0.002 11.318 0.002 xml.py:1207(parse_static_options) 99675 0.029 0.000 0.033 0.000 __init__.py:1004(string_as_bool) 99675 0.004 0.000 0.004 0.000 {method 'lower' of 'str' objects} 99601 0.004 0.000 0.004 0.000 {method 'append' of 'list' objects} 7183 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} 0 0.000 0.000 profile:0(profiler) ``` after: ``` *** PROFILER RESULTS *** parse_static_options (/Users/mvandenb/src/galaxy/lib/galaxy/tool_util/parser/xml.py:1207) function called 7183 times 220899 function calls in 0.260 seconds Ordered by: cumulative time, internal time, call count ncalls tottime percall cumtime percall filename:lineno(function) 7183 0.230 0.000 0.259 0.000 xml.py:1207(parse_static_options) 99675 0.026 0.000 0.029 0.000 __init__.py:1004(string_as_bool) 99675 0.004 0.000 0.004 0.000 {method 'lower' of 'str' objects} 7183 0.000 0.000 0.000 0.000 {method 'values' of 'dict' objects} 7183 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} 0 0.000 0.000 profile:0(profiler) ``` This is most due to openms_idfilter, which has 2928 static options.
- Loading branch information