New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request optimization #1147
Request optimization #1147
Conversation
Merge all dev updates into main
Improve error handling
… operations and reduce code duplication. Needs Python 3.6
What speedup are you seeing? |
Please note that it is specifically against the dev branch that has severe performance degradation for earnings (10s instead of under 3s in 0.1.85 in my tests), This patch cuts the time to get earnings to around 3.5s so still slower than 0.1.85. However the big win is that using this data-class will make performance bugs harder to introduce in the future. |
Great. My only comment is - is cache_maxsize set appropriately? I've not used lru_cache before so don't know if Ticker objects share same cache. |
I just set it to something I figured would be ok. I did not want it to be unlimited. |
I've done some benchmarking - a loop of tickers accessing
1000 elements in get_json_data_stores() cache will hit 5.3 GB I also see no difference with the freezeargs enabled/disabled - what is purpose? Benchmark in case interested:
|
…n of memory usage. Also fixed warning about wrong type used for dataframe index.
Good investigation, I decreased the cache size to 128 so it should now use less than 600 Mb, |
…u_cached methods.
I've lowered the cache size to 64 and fixed so cache_clear and cache_info should now work without disabling freezeargs. |
I'm happy to merge but think sensible to wait 24H in case you ruminate more changes. |
I think the PR is ok to merge. |
I noticed that getting earnings did a lot of duplicate requests that made it quite slow.
When looking into this I found it easier to have one place to retrieve data in order to ease caching and speed up operations and reduce code duplication. Needs Python 3.6
As I use lru_cache I needed to drop Python versions before 3.6, update package metadata to reflect this.