From: "The Fool" <[EMAIL PROTECTED]>

> Not in this particular case.  All the functions are related / use the
> same class variables etc.  Also sometimes speed and efficiency are more
> important than ease of use.

Very rarely - what's going to happen to the code in 6 months when you've
forgotten how half of it works? Is that trade-off worth it? Programmer &
maintenance time usually outweights processing time.

It is extremely unlikely that the overhead of method calls (even vtable
calls) are the performance bottleneck in any realistic project. About the
only time you need to even think about those are when you're writing the
tight inner loop of a 2D/3D/Sound rendering core - and with standard APIs
(OpenGL, DirectX, etc) there's very little need to worry about that.

Even then, one of the projects I'm working on for fun is a 3D engine for the
PocketPC (no DirectX or hardware acceleration) which is entirely C++ and
makes heavy use of code broken up into multiple classes. Using such C++
features as the "inline" directive, const variables, templates,
metaprogramming, etc. you can completely eliminate even the overhead of
function calls and object derefencing. The trick is to make the compiler do
it, not the programmer. Compilers are VERY good at optimizations these days
if you have enough hints in your code.

Besides, trying to optimize without doing profiling is crazy (apart from
obvious things like using good algorithms). It's well known that you should
write the code first and optimize later, since what you think might be the
bottlenecks and what actually turn out to be the bottlenecks are very rarely
the same thing.

Joshua
_______________________________________________
http://www.mccmedia.com/mailman/listinfo/brin-l

Reply via email to