Created
May 1, 2011 05:04
-
-
Save seungjin/950269 to your computer and use it in GitHub Desktop.
speed test with different expressions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/opt/local/bin/python | |
| from datetime import datetime | |
| r1 = [] | |
| for a in range(1,10001) : | |
| begin = datetime.now() | |
| reduce(lambda x,y: x+" " +y,map(lambda x: x.upper(), ["diversity","is","good"])) | |
| end = datetime.now() | |
| r1.append(end-begin) | |
| print reduce(lambda x,y: x+y, r1)/len(r1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/opt/local/bin/python | |
| from datetime import datetime | |
| r2 = [] | |
| for a in range(1,10001) : | |
| begin = datetime.now() | |
| ' '.join(["diversity","is","good"]).upper() | |
| end = datetime.now() | |
| r2.append(end-begin) | |
| print reduce(lambda x,y: x+y, r2)/len(r2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment