3 ms·
Your sibling got opposite results. I haven't dissected either program, but I don't see any obvious flaws. I find your results particularly surprising. Can you e
by burntsushi 10y ago
Your sibling got opposite results. I haven't dissected either program, but I don't see any obvious flaws. I find your results particularly surprising. Can you explain them? Are there optimisations going on in your benchmark that you haven't accounted for?
It should not be controversial that namedtuples are clearer for the reason I stated in my initial comment.
- lqdc13 10y agosys.getsizeof() on a code object returns the size of the code struct, not all the other objects it references. To measure real usage, you have to use another method. I use ipython_memory_usage because it's easy to use. You can test this out easily by making a large dict and see how much your OS thinks python is using vs what sys.getsizeof is reporting.