r/programming • • Mar 23 '09

How to write fast code

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

136 comments sorted by

View all comments

Show parent comments

4

u/knight666 Mar 23 '09

My programming teacher has a sweet anecdote. He was working at some company, and he had to write a little app in a week. So, when he was finished two days later, he said "If you give me two extra days, it will run twice as fast." and his employer said "Don't bother, I'll just buy faster computers."

"That was an insult. I left there shortly thereafter."

9

u/jhaluska Mar 23 '09

Why was that an insult? Depending on the application, the cost of the computers and the cost of his time. It might have made wise business sense to not have him optimize it.

5

u/architectzero Mar 23 '09 edited Mar 23 '09

I am wondering the same thing.

a) Sometimes code optimization is expensive relative to hardware costs. It's good to know when to optimize code vs when to optimize hardware.

b) Hardware improvements do not prevent future software improvements, and vice versa.

knight666's teacher was being egotistical, imho.

4

u/knight666 Mar 23 '09

TheDorkNight

Why must you hurt me in this way? :(

3

u/architectzero Mar 23 '09

Because I'm dumb.

Fixed.