Le 2012-03-02 à 13:32:00, katja a écrit :
How about function call overhead? For constructor and destructor no problem of course, but accessor wrappers will be called often, in fact it doubles the number of function calls for external access.
Constant calls are possibly a lot quicker than variable calls. Pd does call by function pointer, which needs to be figured out before the CPU pipeline can start reading and parsing the machine-code for it. When it's just a function-pointer in a known variable, it's not very slow, and might be very fast (?), but it takes a lot more time if there are conditional statements necessary to figure out which function-pointer should be used. This should tell you a lot about Pd's message-passing if you read that part of Pd.
A wrapper that is specific to each method is very fast, because the pointer is already known.
GridFlow uses two levels of wrappers, one of which is supposed to be slow according to what I say above (because the outer wrapper does its own message dispatch) ; but keeping things in perspective, it's still faster than anything else in Pd, when it comes to doing things that no other Pd class provides.
GEM's wrappers have virtually no runtime overhead, except that wrapper has to be written. GridFlow's method-wrappers are auto-generated, so that you don't have to write them. Those are two big examples of wrapping a C++ library in C so that it can be used in Pd.
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC