relative speed of incremention syntaxes (or "i=i+1" VS "i+=1")

Seebs usenet-nospam at seebs.net
Mon Aug 22 07:33:28 CEST 2011


On 2011-08-21, Andreas L?scher <andreas.loescher at s2005.tu-chemnitz.de> wrote:
> Am Sonntag, den 21.08.2011, 14:52 -0400 schrieb Roy Smith:
>> In article <mailman.282.1313951079.27778.python-list at python.org>,
>>  Christian Heimes <lists at cheimes.de> wrote:
>> > I don't think that's the reason. Modern compiles turn a switch statement
>> > into a jump or branch table rather than a linear search like chained
>> > elif statements.

>> This is true even for very small values of "modern".  I remember the 
>> Unix v6 C compiler (circa 1977) was able to do this.

> What is the difference in speed between a jump table that is searched
> from top to bottom

A jump table isn't searched, it's jumped into.  You don't look through the
table for a matching element, you grab the Nth element of the table.

-s
-- 
Copyright 2011, all wrongs reversed.  Peter Seebach / usenet-nospam at seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.



More information about the Python-list mailing list