[PD] C++ for reusable dsp lib - or better use C?

Mathieu Bouchard matju at artengine.ca
Sat Mar 3 18:40:53 CET 2012

Le 2012-03-03 à 10:32:00, katja a écrit :

> I fail to see how those C wrappers could be inlined. Wouldn't that undo 
> their raison d'être (replacing a C++ call with a C call)? But indeed 
> function call overhead is small when compared to number-crunching, if 
> these calls are done per block and not per sample.

If a function is only called from a single location and the function is 
hidden, then the original function may disappear and become embedded into 
the wrapper. I don't see GEM hiding its classes in such a manner. What 
might happen instead, is that a lot of code gets duplicated into the 
wrapper. This makes the executable bigger, but you still get the extra 
speed from inlining that way (for small functions).

The « omit frame pointer » optimisation may cut a lot of the overhead 
while reducing code size, for function calls that are not inlined.

| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC

More information about the Pd-list mailing list