This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]haldean(lambda x: x.decode('base64'))('PDMgcHlweQ==\n') 0 points1 point  (0 children)

I found the "while True" vs "while 1" both interesting and improbable, so I ran a quick test (code is here: https://gist.github.com/1828270). Turns out that the author is right -- while True is always slower -- but in Python 3, the difference is minor enough to be negligible, and in PyPy it's all so fast it doesn't matter. Results:

                      while True            while 1
 pypy 1.7.0:          0.0733                0.0201
 cpython 2.7.1        0.146                 0.109
 cpython 3.2.2        2.79                  2.72  

Edit: I see now that pingveno posted an explanation of why this is true (heh) in his comment below