On Sun, 23 Aug 2015 10:07 pm, Vladimir Ignatov wrote: > Hi, > >>> for i in range(1000000): #just to create a time interval, seems this >>> disturb cpu cache? >>> pass > > Python interpreter consumes memory quite extensively because > "everything is object". So constructions like: > > range(1000000): > > _take_ memory. Additionally it will trigger garbage collecting code > on deallocation time so expect even more delay.
Normally you would be correct, but as my timing results show, using xrange instead of range does not make any difference. Whatever is going on here, it isn't as simple as "range(1000000) builds a giant list". -- Steven -- https://mail.python.org/mailman/listinfo/python-list