Re: FVWM: Re: Memory Allocations

From: Paul Smith <pausmith_at_nortelnetworks.com>
Date: 23 Mar 2002 03:03:28 -0500

%% Dave Trollope <dave.trollope_at_worldnet.att.net> writes:

>> Yes, but what is the cost of the malloc?

  dt> What does the cost matter when it can be reduced to 10% of the cost?

This is an easy mistake to make when approaching optimization. There is
often great benefit to _not_ optimizing code. There is quite commonly a
tradeoff between "slow" methods that are clearer, simpler, more
reliable, etc., and optimized methods which are more abstract, less
obviously correct, harder to understand and modify in the future, and
potentially less robust.

Optimization is best done like this: write the code the most
straightforward way you can (XP uses the phrase "the simplest thing that
could possibly work", which I like). Run it. If it's slow, use some
kind of empirical evidence gathering method (profilers, etc.) to find
out where the bottlenecks are. Fix the top bottleneck or two. It's
almost always true that (a) you rarely guess right: the bottlenecks you
find are nothing like what you thought they'd be, and (b) optimization
follows the 80/20 rule: you can get 80% of the results for 20% of the
work, then it takes the other 80% of the work to get the last 20% of the
results.


Note I'm not saying that your ideas about how to speed up FVWM are
incorrect. You may well be right. But I personally would like to see
evidence before we complicate the code with special cases, etc.


My $0.02.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <pausmith_at_nortelnetworks.com> HASMAT--HA Software Mthds & Tools
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Sat Mar 23 2002 - 02:04:35 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:52 BST