You are not logged in.

#1 2005-04-14 21:13:31

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

two rules of optimization

M.A. Jackson (Principles of Program Design, 1975) wrote:

Rule 1. Don't do it

Rule 2. (for experts only) Don't do it yet.

I find it funny... reminds me of that "Early optmization is the root of much evil" quote...

Offline

#2 2005-04-14 22:01:26

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: two rules of optimization

I think it was "premature optimization".
I don't know when optimization reached maturity though..a pretty open ended statement, basically amounting to "don't do it".


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2005-04-14 22:20:33

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: two rules of optimization

Depends on what exactly you mean with optimization. I think optimizing the general design and algorithms must be done as early as possible, instead of never.

But silly stuff like replacing int i = 0 with int i ^= i is stupid and must be done by the compiler.

More important than speed is IO handling, as in general IO is slow compared to the cpu, so causing it and waiting for it must be avoided. If you do a lot of IO and IO isn't the bottleneck then you must optimize to increase peformance. Though often it's more important to have good and clean code than to squeeze most out of the thing.

Oh well, there's nothing to disagree here I guess.

Offline

#4 2005-04-14 22:21:10

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: two rules of optimization

well I think it's a valid point... I hate when people at work are like "why do it that way when you can add all this extra crap and error checking and it'll perform better?" and I just sigh... and replace my one line implementation with about 40 lines of crap... you just don't do that unless there's a problem... optimize the bottlenecks only after they've proven to be a problem

Offline

#5 2005-04-15 00:37:23

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: two rules of optimization

Wait... Are you guys saying -O3 is stupid?

Because it sure as hell is. tongue

Offline

#6 2005-04-15 10:43:57

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: two rules of optimization

No, this is something totally different. And -O3 isn't stupid. Using it for everything is stupid. We're talking about programmers manually optimizing their code here.

Offline

#7 2005-04-15 15:45:32

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: two rules of optimization

yeah it's basically one of those typical "maintainable code vs slightly faster code" arguments

Offline

Board footer

Powered by FluxBB