<div dir="ltr">On Wed, Dec 24, 2014 at 4:22 AM, Steven D'Aprano <<a href="mailto:steve%2Bcomp.lang.python@pearwood.info">steve+comp.lang.python@pearwood.info</a>> wrote:<br>> What happens here is that you time a piece of code to:<br>><br>> - Build a large list containing 100 million individual int objects. Each int<br>> object has to be allocated at run time, as does the list. Each int object<br>> is about 12 bytes in size.<br><br><div>Note to the OP: since you're using Python 2 you would do better to loop over an xrange object instead of a range. xrange produces an iterator over the desired range without needing to construct a single list containing all of them. They would all still need to be allocated, but not all at once, and memory could be reused.</div></div>