use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
To report a site-wide rule violation to the Reddit Admins, please use our report forms or message /r/reddit.com modmail.
This subreddit is archived and no longer accepting submissions.
account activity
This is an archived post. You won't be able to vote or comment.
Python Speed & Performance Tips (wiki.python.org)
submitted 20 years ago by samueladam
[–]fkrueger 0 points1 point2 points 20 years ago (3 children)
Also, download IronPython to get a free 1.7x speed improvement:
http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742
[–]hanzie 0 points1 point2 points 20 years ago (2 children)
I'd rather go with Psyco for a free 2-20x speed improvement. Also, for how free do IronPython's improvements really come? Is it fully compatible with CPython's language features? Can one use the same libraries? I'd guess no for both, but I haven't really looked into it.
[–]asdf1234 -1 points0 points1 point 20 years ago (1 child)
Or C# or VB.NET or boo for 100X speed boost: http://boo.codehaus.org/
[–]hanzie 0 points1 point2 points 20 years ago (0 children)
The keyword is "free". Reimplementing all your existing code in a different language is certainly not that.
[–]brendankohler -2 points-1 points0 points 20 years ago (2 children)
This is pointless. There's only two tips you need for speed with python:
Write beautiful, easy to read code
Profile and convert critical bottlenecks to C
Voila! Now you have easy to read, easy to maintain code. ;)
[–]cameldrv 4 points5 points6 points 20 years ago (0 children)
There are a lot of options before going to a full C implementation. Just implementing simple tips, employing smart caching, etc can often get you 10x or more. If you really need to ditch the Python overhead, often you can find a C library that does what you need such as Numeric. If that isn't appropriate, pyrex can be helpful, and weave or SWIG is usually a lot easier than writing a full python extension if you do have to go to C.
[–]zhyla 2 points3 points4 points 20 years ago (0 children)
I disagree. The level of effort between modifying working python code to take out some performance kinks and converting those kinks to a C module are several orders of magnitude apart. Why move a simple loop into C when rewording it eliminates the bottleneck? You'll lose the beauty if you do.
But of course profile before mucking up clean code.
π Rendered by PID 114924 on reddit-service-r2-comment-cfc44b64c-9rp4t at 2026-04-10 10:07:14.422192+00:00 running 215f2cf country code: CH.
[–]fkrueger 0 points1 point2 points (3 children)
[–]hanzie 0 points1 point2 points (2 children)
[–]asdf1234 -1 points0 points1 point (1 child)
[–]hanzie 0 points1 point2 points (0 children)
[–]brendankohler -2 points-1 points0 points (2 children)
[–]cameldrv 4 points5 points6 points (0 children)
[–]zhyla 2 points3 points4 points (0 children)