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


Groups > comp.lang.python > #25732

Re: Basic question about speed/coding style/memory

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bahamutzero8825@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'interpreter': 0.04; 'true,': 0.04; 'cpython': 0.05; 'clause': 0.07; 'executed': 0.07; 'exit': 0.07; 'parsing': 0.07; 'subject:question': 0.08; 'itself.': 0.11; 'bytecode': 0.16; 'executed.': 0.16; 'proceeds': 0.16; 'subject:coding': 0.16; 'url:py3k': 0.16; 'wrote:': 0.17; 'else,': 0.17; 'jan': 0.18; 'windows': 0.19; 'module': 0.19; 'received:209.85.214.174': 0.21; 'assuming': 0.22; 'statement': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'subject:/': 0.28; 'measure': 0.29; 'overhead': 0.29; 'statements': 0.29; 'case,': 0.29; 'evaluation': 0.30; 'code': 0.31; 'url:python': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'really': 0.36; 'message-id:@gmail.com': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'received:192': 0.39; 'skip:" 10': 0.40; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'evaluate': 0.62; 'skip:6 10': 0.63; 'offer': 0.65; 'difference.': 0.84; 'subject:Basic': 0.84; 'cause,': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=XvFWumhtv6EnVBoPLNCSuayJ0KAZewet5g2jQEgwANE=; b=kfJBifadH/2tES+xSCImi95TqhzNWJTI+uTQtfQrUR8YK88r884H51lGgus9dcgGXH LEWZVLqcsw1oafI0Iv4Y5mJu7I7YgpEwpm6+FtCkSF5F/K9dsY28PH5xXl2C7ZzsyxZO MOwisAhzS9zPQw1jzZR0XQVE7Vqp6nAZEaotjIuhnMdE/aujqQCX4wPuetOR0kxUxqfP teiNV87R3PiIhweZcG32pHssjcwnllYtVi5Sm8WK4UsZ4Qrpog9VbkngQQs09TszZE8v UaGKpliaBgqmUXuaDG0SgOe90R4rqpOq/qQ8wo9x/VujDjcUiqcIxKA9FcTjnQdyXpwC HtdA==
Date Sat, 21 Jul 2012 04:05:27 -0500
From Andrew Berg <bahamutzero8825@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0
MIME-Version 1.0
To "comp.lang.python" <python-list@python.org>
Subject Re: Basic question about speed/coding style/memory
References <500A5B47.1060805@freenet.de> <500A6215.8070703@gmail.com> <500A648E.3030807@freenet.de>
In-Reply-To <500A648E.3030807@freenet.de>
X-Enigmail-Version 1.4.3
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2371.1342861536.4697.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342861536 news.xs4all.nl 6940 [2001:888:2000:d::a6]:33466
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25732

Show key headers only | View raw


On 7/21/2012 3:13 AM, Jan Riechers wrote:
> Cause, as I understand the interpreter chooses either the "else" (1st 
> block) or just proceeds with following code outside the if.
If none of the if/elif statements evaluate to something true, the else
block is executed.

> So if there is some overhead in some fashion in case we don't offer the 
> else, assuming the interpreter has to exit the evaluation of the 
> "if"-statement clause and return to a "normal parsing code"-state 
> outside the if statement itself.
I really don't understand. You can look into the dis module if you want
to look at how CPython bytecode is executed and the timeit module to
measure speed. In any case, I don't see how there would be any
significant difference.

http://docs.python.org/py3k/library/dis.html
http://docs.python.org/py3k/library/timeit.html
-- 
CPython 3.3.0b1 | Windows NT 6.1.7601.17803

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


Thread

Re: Basic question about speed/coding style/memory Andrew Berg <bahamutzero8825@gmail.com> - 2012-07-21 04:05 -0500

csiph-web