Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

What is Premature Optimization?

Thread view: 
tenxian - 30 Apr 2008 06:00 GMT
Is it good or bad?
Kenneth P. Turvey - 30 Apr 2008 06:11 GMT
> Is it good or bad?

Bad.  Optimizing before you know what to optimize.. usually by profiling
the application.  

Knuth called it the root of all evil.  

Is this homework?

Signature

Kenneth P. Turvey <kt-usenet@squeakydolphin.com>

Arved Sandstrom - 30 Apr 2008 07:14 GMT
> Is it good or bad?

Not good...the keyword being "premature", meaning "untimely, too soon,
hasty" in this context.

Premature optimization often refers to steps taken to improve speed or
reduce memory consumption, *before* there is reason to believe that such
steps are necessary. It does _not_ refer to judicious choice of fast and/or
memory-consumption-reducing architecture, design, algorithms and data
structures at the earliest possible stage.

AHS
thufir - 01 May 2008 00:24 GMT
> Not good...the keyword being "premature", meaning "untimely, too soon,
> hasty" in this context.
[quoted text clipped - 4 lines]
> and/or memory-consumption-reducing architecture, design, algorithms and
> data structures at the earliest possible stage.

Donald Knuth said, paraphrasing Hoare[1],

   * "We should forget about small efficiencies, say about 97% of the
time: premature optimization is the root of all evil." (Knuth, Donald.
Structured Programming with go to Statements, ACM Journal Computing
Surveys, Vol 6, No. 4, Dec. 1974. p.268.)

http://en.wikipedia.org/wiki/Optimization_(computer_science)

Actually, he's talking about *small* efficiencies.  Just thought I'd post
the quote!

-Thufir
Arne Vajhøj - 01 May 2008 00:31 GMT
> Donald Knuth said, paraphrasing Hoare[1],
>
[quoted text clipped - 7 lines]
> Actually, he's talking about *small* efficiencies.  Just thought I'd post
> the quote!

That is what it is all about.

Programmers taking 4 nice reachable lines of code that work
and replace them with 40 unreadable lines with 3 bugs to achieve
a 5% speed increase of that code which because that code only
takes 0.1% of total time result in a total performance improvement
of 0.0005% and cost the company tens of thousands of dollars to
find and fix the bugs !

Arne
bugbear - 30 Apr 2008 09:26 GMT
> Is it good or bad?

I would like an example use of the word "premature"
where it has a positive connotation; I can't think of one.

 BugBear
Roedy Green - 30 Apr 2008 12:18 GMT
On Tue, 29 Apr 2008 22:00:32 -0700 (PDT), tenxian
<hi.steven.tu@gmail.com> wrote, quoted or indirectly quoted someone
who said :

>Is it good or bad?

Stop jerking us around and ask real questions. Get yourself a project
and write some code.
Signature


Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Joshua Cranmer - 30 Apr 2008 22:01 GMT
> Is it good or bad?

(Typically it's considered bad form to put the main question as the
subject.)

Anyways, "premature optimization" (most likely deriving from the old
quote, "Premature optimization is the root of all evil," attributed to
Donald Knuth, author of TAOCP) is a simple phrase that is not idiomatic,
and thus can be parsed directly.

Premature - something happening before it should
Optimization - the process (or at least an attempt) of increasing
efficiency (with general connotation to time and somewhat so less so to
space)

Therefore, "premature optimization" is the process whereby the
efficiency is increased before it should be, or, cleaning up a bit,
"optimizing" code before one can say whether or not it should be. It
generally refers to people optimizing code based on where he or she
believes the code to be underperforming, instead of based on rigorous
tests which pinpoint the exact blocks which are consuming the most time.

As to your latter question, it is generally considered poor form.
Knuth's quote I've cited above, but another programmer (his name escapes
me at the moment) said something to the effect that "more sins are
committed in the name of optimization than any other cause--including
stupidity." I suspect it is up to decide to yourself, though...

Signature

Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth

RedGrittyBrick - 30 Apr 2008 22:55 GMT
> another programmer (his name escapes  me at the moment) said something to the effect that "more sins are
> committed in the name of optimization than any other cause--including
> stupidity."

Nice quote, it seems to be attributed to a W.A. Wulf.

Presumably this chap:
http://en.wikipedia.org/wiki/William_Wulf

Signature

RGB

Mike Schilling - 01 May 2008 00:15 GMT
> Is it good or bad?

OK, now I'm sure you're a troll.  Begone!


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.