When running the python profiler on this library, I noticed a pretty intense amount of calls and total time spent in Version.py. Upon investigation, I traced the call to a check that happened once per loop in fetch_one. Taking a clue from https://github.com/julien-duponchelle/python-mysql-replication/pull/363/ (which is more than a year old and sitting), I refactored what had initially been a @lru_cache change on my end to just be a static call once and then replaced all if trees that used it with the variable. I also changed as little as possible in an attempt to get this through. Below are the cProfiler stats before and after the change. Tested when parsing through a remote binary log, limited both to 3000 events from the stream reader just to save time, there is a nearly 50% speedup and the calls to Version.py is no longer dead at the top of the cProfiler for time spent.
Type of Change
[ ] Bug fix
[ ] New feature
[ ] Documentation update
[x] Other (please specify below)
Checklist
[x] I have read and understood the CONTRIBUTING.md document.
[x] I have checked there aren't any other open Pull Requests for the desired changes.
[ ] This PR resolves an issue #[Issue Number Here].
Tests
[x] All tests have passed.
[ ] New tests have been added to cover the changes. (describe below if applicable).
Additional Information
As stated above, there IS another PR that makes this change, but likely due to the fact that there were both multiple changes being thrown in and an unresponsive PR, I'm hoping this can make it through as it provides an immense speedup to performance of this library.
Description
When running the python profiler on this library, I noticed a pretty intense amount of calls and total time spent in
Version.py
. Upon investigation, I traced the call to a check that happened once per loop infetch_one
. Taking a clue from https://github.com/julien-duponchelle/python-mysql-replication/pull/363/ (which is more than a year old and sitting), I refactored what had initially been a@lru_cache
change on my end to just be a static call once and then replaced all if trees that used it with the variable. I also changed as little as possible in an attempt to get this through. Below are the cProfiler stats before and after the change. Tested when parsing through a remote binary log, limited both to 3000 events from the stream reader just to save time, there is a nearly 50% speedup and the calls toVersion.py
is no longer dead at the top of the cProfiler for time spent.Type of Change
Checklist
Tests
Additional Information
As stated above, there IS another PR that makes this change, but likely due to the fact that there were both multiple changes being thrown in and an unresponsive PR, I'm hoping this can make it through as it provides an immense speedup to performance of this library.
Before
After