Steve Rogers mentioned this to Gary Weinfurther:
SR> But are we not splitting hairs? Haven't so many compromises already
SR> been made in the creation of Win 95 and Delphi that our efforts at
SR> such optimizations are lost in the sea of "Just throw more CPU power
SR> at it!" attitudes? ;)
Yes, perhaps we are splitting hairs. The difference in speed between a
Pentium processing a 32 bit value versus a 16 bit value is indeed miniscule.
But knowledge of how the CPU works helps you to make better decisions based
on the situation at hand.
A couple of days ago, I optimized a routine by converting it to inline
assembler. After spending several hours on it, I compared its performance to
the original Object Pascal version. With optimizations turned on, the
assembler version was faster, but only by a small percentage. The gain was
so small that the time spent optimizing could have been better spent
elsewhere.
Another time, I did the same thing to a custom bit vector class. In that
case, the assembler version took one fourth of the time the Object Pascal
version did.
The lesson? Readability and maintainability *in most cases* is probably more
important than speed, but when you do optimize, do it in the places where it
will make a difference.
...Gary
--- GoldED 2.41
---------------
* Origin: The Flying Circus BBS. (1:2410/905)
|