[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tradeoffs with resources



    Date: Fri, 21 Sep 90 11:11:52 EDT
    From: CarlManning@ai.mit.edu

    ....
    But if all this ... ISN'T taking a significant time ..., then
    using resources may not help.  No one wants to waste their time
    worrying about low level allocation efficiency where it doesn't matter
    (as a stereotypical C programmer might), so METER the running
    application first, to make sure initialization is a significant time
    sink.

Excellent comment.  As Allan Wechsler said in the Symbolics performance
optimization course, "gratuitous optimization is 1evil0."  His point was
that if you go around optimizing things without knowing that they are
causing problems, or worse yet, try to write your code in an "optimized"
form from square one, you'll create more difficulties than you resolve.
Code readability and maintainability is often seriously compromised, and
you may end up slowing things down rather than speeding things up if you
don't really know where the performance problems reside (or that they in
fact exist).  Learn to use the metering system, and apply this knowledge
before doing any tuning of your code.  I highly recommend the course I
mentioned above as a way to accomplish this; since I took it, metering
has become for me simply another tool to use when I need it.  Using the
metering system to the best advantage is more subtle than it may appear
on the surface, since there is so much information collected that it
simply cannot all be presented, and the interface summarizes it in a
variety of ways the meaning and interpretation of which is not obvious.
Also, keep in mind that different hardware configurations have different
performance characteristics, so meter on all the ones you plan to use.

(Sorry if the above sounds preachy, especially for those of you in the
choir.  It's just that this is a hard lesson to learn, and even now I
have to periodically remind myself that I really don't know off the top
of my head where and how to improve the performance of most programs.
I've seen too many programs containing bogus "performance enhancements"
to believe that a majority of hackers understand this issue clearly.)