Is there any particular reason why Cython has specific code like __Pyx_PyObject_Call2Args, __Pyx_PyObject_Call3Args, ...

And then there is even more complicated Python code in PyMethodCallNode generating something like __Pyx_PyObject_Call2Args for an arbitrary number of arguments.

This could be simplified a lot by just writing code once to deal with n arguments and then letting the C compiler do the clever stuff: if you write a loop where the number of iterations is a small compile-time constant, the compiler should unroll it.

I checked that GCC-6.4.0 is able to do this and the much simpler code with a for loop is as efficient as the current code. But maybe there are other compilers that don't do this (or there used to be such compilers when that code was written)?

I stumbled on this while working on https://github.com/cython/cython/issues/2996
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to