Closed FrostyX closed 1 year ago
I didn't test all the scenarios but it looks like this may be 10x speedup improvement. At least while writing this PR, it went from ~60s to ~6s on my laptop (12s when a debugger is enabled).
The bottleneck is now in the psutil
library, not in our code.
ncalls tottime percall cumtime percall filename:lineno(function)
2 0.000 0.000 12.833 6.416 tracer.py:1(<module>)
...
1 0.011 0.011 9.065 9.065 memory.py:25(dump_memory)
538 0.016 0.000 8.968 0.017 processes.py:205(files)
538 0.037 0.000 8.745 0.016 processes.py:127(memory_maps) <--- Still our code
538 0.213 0.000 8.707 0.016 __init__.py:1115(memory_maps) <--- psutil library
6800/3873 0.055 0.000 8.035 0.002 _pslinux.py:1650(wrapper)
538 0.789 0.001 7.919 0.015 _pslinux.py:1959(memory_maps)
217034 4.068 0.000 5.683 0.000 _pslinux.py:1968(get_blocks)
Fix RHBZ 2094448
I couldn't reproduce the exact
from the mentioned RHBZ but I replaced the regex with simpler operations and also added some caching here and there to get a big performance boost.