[issue27128] Add _PyObject_FastCall()

2016-09-01 Thread STINNER Victor
STINNER Victor added the comment: The main features (_PyFunction_FastCall()) has been merged. Supporting keyword arguments is now handled by other issue (see issue #27830). I close this issue. -- resolution: -> fixed status: open -> closed ___ Pytho

[issue27128] Add _PyObject_FastCall()

2016-08-22 Thread STINNER Victor
STINNER Victor added the comment: Ok, I see much better with concrete commits. I'm really happy that Cython also benefits from these enhancements. Note: handling keywords is likely to change quickly ;-) -- ___ Python tracker

[issue27128] Add _PyObject_FastCall()

2016-08-22 Thread Stefan Behnel
Stefan Behnel added the comment: > What do you mean by "I copied your (no-kwargs) implementation"? I copied what you committed into CPython for _PyFunction_FastCall(): https://github.com/cython/cython/commit/8f3d3bd199a3d7f2a9fdfec0af57145b3ab363ca and then enabled its usage in a couple of pla

[issue27128] Add _PyObject_FastCall()

2016-08-22 Thread STINNER Victor
STINNER Victor added the comment: Serhiy: I "moved" your msg273365 to the issue #27809. -- ___ Python tracker ___ ___ Python-bugs-list

[issue27128] Add _PyObject_FastCall()

2016-08-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The problem is that passing keyword arguments as a dict is not the most efficient way due to an overhead of creating a dict. For now keyword arguments are pushed on the stack as interlaced array of keyword names and values. It may be more efficient to push v

[issue27128] Add _PyObject_FastCall()

2016-08-22 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7dd85b19c873 by Victor Stinner in branch 'default': Optimize call to Python function without argument https://hg.python.org/cpython/rev/7dd85b19c873 -- ___ Python tracker

[issue27128] Add _PyObject_FastCall()

2016-08-22 Thread STINNER Victor
STINNER Victor added the comment: > FYI: I copied your (no-kwargs) implementation over into Cython and I get > around 17% faster calls to Python functions with 2 positional arguments. Hey, cool! It's always cool to get performance enhancement without having to break the C API nor having to mod

[issue27128] Add _PyObject_FastCall()

2016-08-22 Thread Stefan Behnel
Stefan Behnel added the comment: FYI: I copied your (no-kwargs) implementation over into Cython and I get around 17% faster calls to Python functions with 2 positional arguments. -- ___ Python tracker

[issue27128] Add _PyObject_FastCall()

2016-08-21 Thread Stefan Behnel
Changes by Stefan Behnel : -- nosy: +scoder ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread STINNER Victor
STINNER Victor added the comment: I created two new issues: * issue #27809: _PyObject_FastCall(): add support for keyword arguments * issue #27810: Add METH_FASTCALL: new calling convention for C functions -- ___ Python tracker

[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset c2af917bde71 by Victor Stinner in branch 'default': PyFile_WriteObject() now uses fast call https://hg.python.org/cpython/rev/c2af917bde71 New changeset 0da1ce362d15 by Victor Stinner in branch 'default': import_name() now uses fast call https://hg.

[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread STINNER Victor
STINNER Victor added the comment: Ok, I updated the most simple forms of function calls. I will open new issues for more complex calls and more sensible parts of the code like ceval.c. Buildbots seem to be happy. -- ___ Python tracker

[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3ab32f7add6e by Victor Stinner in branch 'default': Issue #27128: _pickle uses fast call https://hg.python.org/cpython/rev/3ab32f7add6e -- ___ Python tracker _

[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset 73b00fb1dc9d by Victor Stinner in branch 'default': Cleanup call_method() and call_maybe() https://hg.python.org/cpython/rev/73b00fb1dc9d New changeset 8e085070ab28 by Victor Stinner in branch 'default': call_method() and call_maybe() now use fast c

[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2da6dc1c30d8 by Victor Stinner in branch 'default': contains and rich compare slots use fast call https://hg.python.org/cpython/rev/2da6dc1c30d8 New changeset 2d4d40da2aba by Victor Stinner in branch '3.5': Fix a refleak in call_method() https://hg.

[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset a1a29d20f52d by Victor Stinner in branch 'default': Add _PyObject_FastCall() https://hg.python.org/cpython/rev/a1a29d20f52d New changeset 89e4ad001f3d by Victor Stinner in branch 'default': PyEval_CallObjectWithKeywords() uses fast call https://hg.p

[issue27128] Add _PyObject_FastCall()

2016-08-16 Thread STINNER Victor
STINNER Victor added the comment: > 5) Reverted changes in Objects/descrobject.c. They added a regression in > namedtuple attributes access. Oh, I now understand. The change makes "namedtuple.attr" slower. With fastcall-3.patch attached to this issue, the fast path is not taken on this benchma

[issue27128] Add _PyObject_FastCall()

2016-08-16 Thread STINNER Victor
STINNER Victor added the comment: Patch version 3: simpler and shorter patch * _PyObject_FastCall() keeps its kwargs parameter, but it must always be NULL. Support for keyword arguments will be added later. * I removed PyObject_CallNoArg() and PyObject_CallArg1() * I moved _PyStack_AsTuple() to

[issue27128] Add _PyObject_FastCall()

2016-08-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset 288ec55f1912 by Victor Stinner in branch 'default': Issue #27128: Cleanup _PyEval_EvalCodeWithName() https://hg.python.org/cpython/rev/288ec55f1912 New changeset e615718a6455 by Victor Stinner in branch 'default': Use Py_ssize_t in _PyEval_EvalCodeW

[issue27128] Add _PyObject_FastCall()

2016-08-16 Thread STINNER Victor
STINNER Victor added the comment: Serhiy Storchaka added the comment: >> Do you suggest to not add these 2 new functions? > > Yes, I suggest to not add them. The API for calling is already too large. > Internally we can directly use _PyObject_FastCall(), and third party code > should get benefit

[issue27128] Add _PyObject_FastCall()

2016-08-12 Thread Antti Haapala
Antti Haapala added the comment: About "I hesitate between the C types "int" and "Py_ssize_t" for nargs. I read once that using "int" can cause performance issues on a loop using "i++" and "data[i]" because the compiler has to handle integer overflow of the int type." This is true because of -

[issue27128] Add _PyObject_FastCall()

2016-08-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Do you suggest to not add these 2 new functions? Yes, I suggest to not add them. The API for calling is already too large. Internally we can directly use _PyObject_FastCall(), and third party code should get benefit from optimized PyObject_CallFunctionObjA

[issue27128] Add _PyObject_FastCall()

2016-08-09 Thread STINNER Victor
STINNER Victor added the comment: > Benchmarking results look nice, but despite the fact that this patch is only small part of issue26814, it looks to me larger that it could be. Oh I failed to express my intent. This initial patch is not expected to introduce any speedup. In fact I noticed majo

[issue27128] Add _PyObject_FastCall()

2016-08-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Benchmarking results look nice, but despite the fact that this patch is only small part of issue26814, it looks to me larger that it could be. 1. The patch includes two parts: adding _PyObject_FastCall() and adding PyObject_CallNoArg() and PyObject_CallArg1(

[issue27128] Add _PyObject_FastCall()

2016-08-08 Thread STINNER Victor
STINNER Victor added the comment: I spent the last 3 months on making the CPython benchmark suite more stable and enhance my procedure to run benchmarks to ensure that benchmarks are more stable. See my articles: https://haypo-notes.readthedocs.io/microbenchmark.html#my-articles I forked and

[issue27128] Add _PyObject_FastCall()

2016-08-07 Thread STINNER Victor
STINNER Victor added the comment: (Oops, I removed a broken fastcall-2.patch which didn't include new pystack.c/pystack.h files. It's now fixed in the new fastcall-2.patch.) -- ___ Python tracker _

[issue27128] Add _PyObject_FastCall()

2016-08-07 Thread STINNER Victor
Changes by STINNER Victor : Added file: http://bugs.python.org/file44041/fastcall-2.patch ___ Python tracker ___ ___ Python-bugs-list mailing

[issue27128] Add _PyObject_FastCall()

2016-08-07 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file44040/fastcall-2.patch ___ Python tracker ___ ___ Python-bugs-list mailin

[issue27128] Add _PyObject_FastCall()

2016-08-07 Thread STINNER Victor
STINNER Victor added the comment: Rebased patch. -- Added file: http://bugs.python.org/file44040/fastcall-2.patch ___ Python tracker ___ _

[issue27128] Add _PyObject_FastCall()

2016-06-09 Thread STINNER Victor
STINNER Victor added the comment: Serhiy Storchaka added the comment: > See issue27213. Maybe fast call with keyword arguments would avoid the > creation of a dict. In a first verison of my implementation, I used dictionary items stored a a list of (key, value) tuples in the same PyObject* C ar

[issue27128] Add _PyObject_FastCall()

2016-06-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See issue27213. Maybe fast call with keyword arguments would avoid the creation of a dict. -- ___ Python tracker ___

[issue27128] Add _PyObject_FastCall()

2016-05-26 Thread STINNER Victor
STINNER Victor added the comment: Updated bench_fast-2.py result with Python compiled with PGO+LTO, with benchmark.py fixed to compute average + standard deviation. Only getattr() really seems slower: --+---+-- Tests

[issue27128] Add _PyObject_FastCall()

2016-05-26 Thread STINNER Victor
STINNER Victor added the comment: default-May26-13-36-33.log: CPython benchmark suite run using stable config. Faster (15): - regex_effbot: 1.26x faster - telco: 1.08x faster - unpack_sequence: 1.07x faster - mako_v2: 1.05x faster - meteor_contest: 1.05x faster - chaos: 1.04x faster - nbody: 1.0

[issue27128] Add _PyObject_FastCall()

2016-05-26 Thread STINNER Victor
STINNER Victor added the comment: Quick & dirty microbenchmark: I ran bench_fast-2.py of the issue #26814. It looks like everything is slower :-p In fact, I already noticed this issue and I think that it is fixed with better compilation option: use "./configure --with-lto" and "make profile-op

[issue27128] Add _PyObject_FastCall()

2016-05-26 Thread STINNER Victor
New submission from STINNER Victor: Since the issue #26814 proved that avoiding the creation of temporary tuples to call Python and C functions makes Python faster (between 2% and 29% depending on the benchmark), I extracted a first "minimal" patch to start merging this work. The first patch