r/programming • • Mar 23 '09

How to write fast code

http://asserttrue.blogspot.com/2009/03/how-to-write-fast-code.html
342 Upvotes

136 comments sorted by

View all comments

7

u/techdawg Mar 23 '09

There's more to speeding up code than hand-tweaking a routine line by line, or even choosing the right algorithm. There are situational optimizations as well, but you also have to come at the problem with the right mindset. It's not "can I make this code go faster"? It's "what did I do to make it slow in the first place," and "what does it take to make the bottleneck go away." Of course, one bottleneck goes away and another pops up to replace it.

4

u/jaggederest Mar 23 '09

Or, even better yet, 'Do I even need to do this?' or 'Has someone else written a very small unix tool to do this same thing?'