[Python-Dev] Benchmarks why we need PEP 576/579/580
On Sun, Jul 22, 2018 at 7:42 PM Jeroen Demeyer <J.Demeyer at ugent.be> wrote:
> On 2018-07-22 08:27, INADA Naoki wrote:
> > It's interesting... But I failed to build sage.
> What went wrong?
I can't install Sage into my virtual environment, so I can't run
> python -m timeit -s "from sage.all import MatrixSpace, GF; M =
> MatrixSpace(GF(9), 200).random_element()" "M * M"
But I can run it finally, with `sage -python` command.
profiled what is the bottleneck of this oneliner.
Cython does optimizations like CPython does internally.
When calling function with one arg, and if the function is PyCFunction,
Cython call underlaying C function directly.
cfunc = PyCFunction_GET_FUNCTION(func);
self = PyCFunction_GET_SELF(func);
result = cfunc(self, arg);
This is why such regression happened on even Python 2.7.
And I think I can write small benchmark emulate it for now.
INADA Naoki <songofacandy at gmail.com>