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

Date 2012-07-21 04:05 -0500
From Andrew Berg <bahamutzero8825@gmail.com>
Subject Re: Basic question about speed/coding style/memory
References <500A5B47.1060805@freenet.de> <500A6215.8070703@gmail.com> <500A648E.3030807@freenet.de>
Newsgroups comp.lang.python
Message-ID <mailman.2371.1342861536.4697.python-list@python.org> (permalink)

Show all headers | 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