Sort of an advanced request here. I have a simulation system that schedules tasks to be run at some point in the future (in iterations, not real time). The system must support calling any member function on any kind of object, and it would be nice if it supported calling any global function too. With one exception: all the called functions return void and (aside from the this pointer) take no arguments.
I'm currently using boost::function for this, but with 10000 scheduled tasks, performance goes down the drain. Profiling shows that 80% of the time is spent in the boost::function call mechanism.
So my question: does anyone have an idea for a high-performance calling system that can do exactly what I need, no more, no less? The system must be portable - targets include (but should not be limited to) x86, amd64, and IBM Power4 and 5 architectures. (That's two 32-bit, two 64-bit architectures, two little-endian, two big-endian, with completely different instruction sets and possibly calling conventions.)