Re: how to handle cpu cache in python ( or fastest way to call a function once)

2015-08-23 Thread Steven D'Aprano
On Sun, 23 Aug 2015 10:07 pm, Vladimir Ignatov wrote: > Hi, > >>> for i in range(100): #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

Re: how to handle cpu cache in python ( or fastest way to call a function once)

2015-08-23 Thread Vladimir Ignatov
Hi, >> for i in range(100): #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(100): _take_ memory. Additionally it will trigger garbage collec

Re: how to handle cpu cache in python ( or fastest way to call a function once)

2015-08-23 Thread Steven D'Aprano
On Sun, 23 Aug 2015 04:10 pm, Yuzhi Xu wrote: > I find out that python's VM seems to be very unfriendly with CPU-Cache. Possibly. More comments below. > for example: > *** > import time > a = range(500) > > sum(a) > > for i in range(100): #just to c

Re: how to handle cpu cache in python ( or fastest way to call a function once)

2015-08-23 Thread Stefan Behnel
Yuzhi Xu schrieb am 23.08.2015 um 08:10: > I find out that python's VM seems to be very unfriendly with CPU-Cache. > see: > http://stackoverflow.com/questions/32163585/how-to-handle-cpu-cache-in-python-or-fastest-way-to-call-a-function-once > http://stackoverflow.com/question

how to handle cpu cache in python ( or fastest way to call a function once)

2015-08-22 Thread Yuzhi Xu
I find out that python's VM seems to be very unfriendly with CPU-Cache. see: http://stackoverflow.com/questions/32163585/how-to-handle-cpu-cache-in-python-or-fastest-way-to-call-a-function-once http://stackoverflow.com/questions/32153178/python-functionor-a-code-block-runs-much-slower-w