On Sun, Jul 22, 2018 at 7:42 PM Jeroen Demeyer <j.deme...@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. And I profiled what is the bottleneck of this oneliner. https://gist.github.com/methane/91533f68e88f89b7ec7f71855c069792 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 <songofaca...@gmail.com> _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com