how to handle cpu cache in python ( or fastest way to call a function once)
steve at pearwood.info
Sun Aug 23 14:42:56 CEST 2015
On Sun, 23 Aug 2015 10:07 pm, Vladimir Ignatov wrote:
>>> for i in range(1000000): #just to create a time interval, seems this
>>> disturb cpu cache?
> Python interpreter consumes memory quite extensively because
> "everything is object". So constructions like:
> _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
More information about the Python-list