Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95586

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

References <2aa39ddd-bb07-4a09-a046-a011e215882a@googlegroups.com> <mrc58f$9e5$1@ger.gmane.org>
Date 2015-08-23 08:07 -0400
Subject Re: how to handle cpu cache in python ( or fastest way to call a function once)
From Vladimir Ignatov <kmisoft@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.33.1440331655.17298.python-list@python.org> (permalink)

Show all headers | View raw


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.
To get most out of Python - all "numbers crushing" / "pixel pushing" /
"store gigabytes" code should go to low-level compiled binary
libraries.


Vladimir

https://itunes.apple.com/us/app/python-code-samples/id1025613117

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to handle cpu cache in python ( or fastest way to call a function once) Yuzhi Xu <yuzhixu.ruc@gmail.com> - 2015-08-22 23:10 -0700
  Re: how to handle cpu cache in python ( or fastest way to call a function once) Stefan Behnel <stefan_ml@behnel.de> - 2015-08-23 11:54 +0200
  Re: how to handle cpu cache in python ( or fastest way to call a function once) Steven D'Aprano <steve@pearwood.info> - 2015-08-23 21:59 +1000
  Re: how to handle cpu cache in python ( or fastest way to call a function once) Vladimir Ignatov <kmisoft@gmail.com> - 2015-08-23 08:07 -0400
    Re: how to handle cpu cache in python ( or fastest way to call a function once) Steven D'Aprano <steve@pearwood.info> - 2015-08-23 22:42 +1000

csiph-web