Since the source code is interpreted while running, I think it might make a difference in Performance. What I mean is:
When you have a long (>9000 lines) code and then cut out as many spaces and linebreaks as possible, does it make the program run faster?
If so, does this apply to languages using bytecode (i.e. Java) too?
Best How To :
Your Python sourcecode (.py) is "compiled" into a representation that does away with all whitespace (.pyc). Instead of doing this transformation over and over again you can just run the .pyc files. So no, whitespace doesn't matter.
If you want performance the best thing to do is optimize your algorithm.
- Don't start peephole optimizing too early; clear, well-designed code is your first aim.
- After that, since your code is comprehensible and designed (hopefully) for insight and change, find out where the bottlenecks are: Look at the "big-O" complexity of your algorithms (
O(n^2), etc.) and try to improve that.
- After that you might use a profiler to find remaining bottlenecks. You can often improve them easily since your code is well structured.
In short: Leaving out whitespace is no good. Understandable code is the way to optimization.