-
Notifications
You must be signed in to change notification settings - Fork 84
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
Large Memory Footprint #86
Comments
I only did memory optimization in C/C++. In C/C++, 7-card evaluation indeed costs 144kb memory. Actually, most of memory usage are indeed constant tables initialized at the global memory region. But Python is completely different, as it uses an interpreter instead of compiling the code to assembly, it's hard to maintain the same memory usage as in C/C++. An alternative solution is to compile the C library (the Having said that, hundreds of Mb is way too big. I believe that's probably also loading the tables for Omaha evaluation. You may try removing those Omaha related methods and tables (maybe just do it in |
Oh yes, that seems to have done the trick. It's now down quite significantly:
Would you require my support to try and create a PR to amend the |
It would be nice if you can fix the import code. Thank you! |
I will spend some time tomorrow making an attempt. |
No need to rush. Thanks a lot! |
I ended up doing it before going to bed, see #87 The tests that were written failed for me from the start, wasn't sure if that was a me problem so I left it alone. I'll continue discussion from now on in the PR |
Using the Python version of this library: https://pypi.org/project/phevaluator/, there is a large memory footprint of 399.9 MiB when importing
evaluate_cards
.Here is the code I used in order to determine this:
and the output:
This was causing me to get memory issues on my deployment which is how I noticed the problem in the first place.
Now, I'm not sure why as I believe it's only supposed to be ~100kb for a 7 card evaluation. Is this meant to be on top of the already memory used for initialization? I'm assuming it might be because it's loading most of the tables, but from what I saw it's not importing any PLO which I believe is the bulk of the memory usage.
Please let me know if this is expected and recommendations to reduce this given I only need the standard 7 card evaluation.
The text was updated successfully, but these errors were encountered: