[Barry A. Warsaw] > ... > from types import StringType > import time > r = range(1000000) > > def one(r=r): > x = 'hello' > t0 = time.time() > for i in r: Random clue: when you're too lazy to try to subtact out loop overhead (not a knock, I am too), you may have better luck with r = [1] * 1000000 than r = range(1000000) The reason is that the former way gets to keep incref'ing and decref'ing a single object (as it's repeatedly bound to "i" across iterations), instead of slobbering all over memory inc'ing and dec'ing a million distinct objects. there's-as-an-art-to-doing-nothing-quickly-ly y'rs - tim
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4