The code i wrote back then was for the gumstix (quickly reviewing it, i
think the wrong version of the Fixed Point code might have end up in
there, but i am too busy right now to correct it :-(, it seems
essentialy like some older tests i was doing....anyway that's besides
the point )
I too wanted to have a "hard" experience of performance differences (if
any) between C, C++, ASM, this optimisation, that optimisation blah blah
blah. All in all, (i agree with Dave Hylands on this one) one can write
C++ code as fast as C code.
The basic advantage i found with C++ was the fact that the C++ fixed
point template could be incorporated far easier into my existing code.
This was a template vector with additional functionality for operations
such as convolution. So, in this case i could do:
type MyVector<float> SamplesVector;
type MyVector<MyFixedPointClass> SamplesVector;
And still use whatever code i had on processing the SamplesVector...
(Well, OK it needs a couple of modifications but not something terrible
The "problem" with classes (and function calling in general) is that
every function call means:
jump to function
Pop Registers (And essentialy jump back to where you were)
The Push and Pop operations take time (An argument against C++) BUT in
this case you make all the functions INLINE (Which in this case blows
away the above argument against C++ :-) )...The binary will end up been
bigger but the execution of the code that uses this functionality will
The same applies to loops...One can unroll the loops and make the code
even faster... (The ultimate optimisation step in the case of PXA255 is
to use the DSP core of course)
In the C version, a similar trick is used with the DEFINEs....In that
case you don't need special code to do addition and subtraction, except
in the case where you need saturation.
Those primitive benchmarks back then were performed to demonstrate the
performance impact of Fixed Point code and various optimisations one can
make at compile time.....not to discriminate between C and C++ :-)
Both ways of writing C are equally useful when the "tools" (templates,
classes, pointers, etc) on offer are used properly to solve a particular
Hope this helps. If i may ask, what are you trying to do?
All the best