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)

Path csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <kmisoft@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'binary': 0.05; 'memory.': 0.05; 'additionally': 0.09; 'garbage': 0.09; 'interval,': 0.09; 'libraries.': 0.09; 'python': 0.10; 'subject:python': 0.14; 'interpreter': 0.15; 'subject: \n ': 0.15; 'low-level': 0.16; 'subject:fastest': 0.16; 'memory': 0.17; 'pass': 0.22; 'seems': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'collecting': 0.27; 'cpu': 0.29; 'extensively': 0.29; 'code': 0.30; 'compiled': 0.32; 'received:google.com': 0.35; 'quite': 0.35; 'should': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'hi,': 0.38; 'to:addr:python.org': 0.40; 'more': 0.63; 'subject: ( ': 0.84; 'subject:handle': 0.84; 'url:app': 0.84; 'disturb': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=PbibR/JE/j0MtrU2txwRpr4b15qa1XRtUNZSXKGaZZI=; b=ubU+J5lK5MKJkymp+y4yOdCM2ZxcbbmGeydYXhpNEVdU4X4N/y9rLfBD9XPo0Ltf9z WiWTWZ68ylFWkNY3OTFrLcYz5/LZoh6ZVnW5Ld0Fe6NzqN7U1SUQwm1ho8/aRBOo6hHb /uu3yxJ4I1m/ISctnO2RVmN+d/Y6Yckl/uHHWapGnztSAiVcVd1ipYr/tQEv8uEMTTDc cd2KwcXZz3fLUNFwjL4l8ltOGjbt74doHqm/KpBE+d4cDRvbETsUzUoQxiMr2xND/o3k lDhbLgJgPiHsIBGiijP+4w0DTJiyQxnTX4CLJWKuCCBYTbWTDsYGc0mGlr5SlvaaM00r spyA==
MIME-Version 1.0
X-Received by 10.70.135.233 with SMTP id pv9mr35832689pdb.9.1440331646694; Sun, 23 Aug 2015 05:07:26 -0700 (PDT)
In-Reply-To <mrc58f$9e5$1@ger.gmane.org>
References <2aa39ddd-bb07-4a09-a046-a011e215882a@googlegroups.com> <mrc58f$9e5$1@ger.gmane.org>
Date Sun, 23 Aug 2015 08:07:26 -0400
Subject Re: how to handle cpu cache in python ( or fastest way to call a function once)
From Vladimir Ignatov <kmisoft@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.33.1440331655.17298.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1440331655 news.xs4all.nl 23725 [2001:888:2000:d::a6]:45539
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95586

Show key headers only | 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