I've got some code that takes a PythonFunction
.
The standard way of invoking it seems to be:
engine.Operations.Invoke(myfunction, arg);
However, I've found experimentally that
((dynamic) myfunction)(arg)
Is very approximately twice as fast. I've been trying to figure out how exactly casting to dynamic
can expose an invokable interface and where to see the code that runs under those circumstances.
Can someone point me to where in the PythonFunction
code the implementation of dynamic
invoke is?