I've been writing a Python module which contains a few classes. As I have come to use the module in earnest it has become clear that I need to create a _very_ large number of instances of these classes. This is using more memory than I would like. Speed is not an issue but memory is becoming a serious issue for me.
So, my question is: if I recode the module in C/C++ will I gain any memory saving over a Python module? Or do classes/structs/variables instantiated from a Python program have the same overhead as straight Python?
Whilst I have used __slots__ where possible to gain a small improvement I feel I need to go much further. The other alternative is to completely change the way my module works. Before running down either route I wondered if anyone more familiar with Python could shed any light on this for me?