Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
♤♢☞ 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 ☜♢♤ calculating the exact memory consumption in Python is mostly useless. First of all this depends on the implementation of the Python interpreter and therefore the calculated value isn't very meaningful. Then there's the problem that Python doesn't have deterministic memory usage because it has a runtime and a garbage collector. So even if we had the correctly calculated value for the memory consumption of our data it wouldn't necessarily represent the additional memory consumption of the Python runtime. The whole point of Python is simplicity not efficiency and if you're start counting bytes in Python you're probably using the wrong language. I'm not saying the question isn't interesting, it's good to know that Python in this case has a massive overhead over systems programming languages but the exact memory consumption has no meaning in the real world.
18th Jan 2021, 1:58 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
- 1
This seems like a breakdown of memory consumption of a specific Python implementation. It's interesting to see that there is a significant overhead using Python over more low level languages but the details wouldn't worry me if I'd use Python. If I someone cares about memory consumption he wouldn't use Python anyway but a systems programming language like C/C++ or Rust where memory usage is much more deterministic and predictable.
17th Jan 2021, 5:50 PM
Aaron Eberhardt
Aaron Eberhardt - avatar