delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/21/12:35:14

Date: Thu, 21 Oct 1999 13:53:37 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: Mouse Events Problem
In-Reply-To: <7ul9ig$e2f$1@solomon.cs.rose-hulman.edu>
Message-ID: <Pine.SUN.3.91.991021135319.2684C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 20 Oct 1999, Damian Yerrick wrote:

> > Anyway, you should never try to optimize the code before you wrote it.
> > Once you get the program working, if it runs too slow, profile it and see
> > where it spends most of the time.  More often than not, you will be
> > surprised by what the profiler shows.  Which means that optimizing early
> > generally means you optimize in the wrong place.
> 
> Any good HowTo pages on optimization?

On the net, I don't know.  A good book about optimizations is "Writing
Efficient Programs" by Jon Bentley (Prentice-Hall, 1982).  Some of the
material there is obsolete, because compilers are so much better now
in optimizing code; but the principles still hold.

Anyway, the two most important rules of optimization are:

	Rule no.1: Don't do it.
	Rule no.2: Don't do it yet.

In fact, *because* the compilers are so good in optimizing, I think
you should generally consider optimizations later in the program
development cycle, and only if there's a real problem in program
performance.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019