[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-13 Thread STINNER Victor
STINNER Victor added the comment: When I worked on FASTCALL, I wasn't sure that the whole project was worth it. Now I am more confident that it makes function calls faster: https://haypo.github.io/fastcall-microbenchmarks.html Stefan, Serhiy: would it be a good idea to make _PyObject_FastCall()

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-13 Thread Stefan Behnel
Stefan Behnel added the comment: > Are all uses of internal CPython details optional? Well, what classifies as a "CPython detail" sometimes just becomes clear when other implementations don't have it. ;-) But yes, the C code that Cython generates selects alternative implementations based on

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Great! Are all uses of internal CPython details optional? I would disable them by default for alpha versions of CPython. -- ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-12 Thread Stefan Behnel
Stefan Behnel added the comment: For future reference, this change is supported by Cython 0.26 (which is currently close to release). -- ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-12 Thread Tim Graham
Tim Graham added the comment: Thanks, I'm not sure what that means exactly but I added the note to https://github.com/numpy/numpy/issues/9391. Perhaps a note in the Python release notes is warranted? -- ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think you need to update Cython to a version that supports new FASTCALL call convention in 3.7. If the support of FASTCALL in Cython is optional try to disable it. -- ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-12 Thread Tim Graham
Tim Graham added the comment: Hi, I observed an error while trying to install numpy after 6969eaf4682beb01bc95eeb14f5ce6c01312e297. gcc: numpy/random/mtrand/mtrand.c numpy/random/mtrand/mtrand.c: In function ‘__Pyx_PyCFunction_FastCall’: numpy/random/mtrand/mtrand.c:44374:5: error: too

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Removed _PyArg_NoStackKeywords() (7e60192fe0dfd763b0d458cf0898ba4f7ac7d81a). -- status: open -> closed ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-10 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +2706 ___ Python tracker ___ ___

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-10 Thread STINNER Victor
STINNER Victor added the comment: Let's remove this function which became useless. -- ___ Python tracker ___

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Josay noticed that _PyArg_NoStackKeywords() is not used anymore except for one place (_hashopenssl.c). Seems this is my oversign. Generated constructors in _hashopenssl.c use the METH_FASTCALL | METH_KEYWORDS calling method, but check that no keyword

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-09 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-05 Thread STINNER Victor
STINNER Victor added the comment: New changeset 8207c17486baece8ed0ac42d9f8d69ecec4ba7e4 by Victor Stinner in branch 'master': Revert "bpo-30822: Fix testing of datetime module." (#2588) https://github.com/python/cpython/commit/8207c17486baece8ed0ac42d9f8d69ecec4ba7e4 --

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-07-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 6969eaf4682beb01bc95eeb14f5ce6c01312e297 by Serhiy Storchaka in branch 'master': bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955) https://github.com/python/cpython/commit/6969eaf4682beb01bc95eeb14f5ce6c01312e297

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-27 Thread STINNER Victor
STINNER Victor added the comment: Oh, it seems like this change should help to use FASTCALL in the _decimal module: issue #29301. Stefan doesn't want to use Argument Clinic. -- ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-26 Thread STINNER Victor
STINNER Victor added the comment: > Can the PR be applied then? It looks good to me. Go for it Serhiy. Even if it isn't faster today, we might find more optimizations later, at least in term of C stack consumption. Moreover, I understand perfectly the cost of having to parse arguments.

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-25 Thread Stefan Behnel
Stefan Behnel added the comment: Can the PR be applied then? It looks good to me. -- ___ Python tracker ___

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-12 Thread STINNER Victor
STINNER Victor added the comment: > Also with that, many implementors will not want to care about keyword > arguments and would thus appreciate it if they didn't have to. Forcing them > to test for keyword arguments and raising the correct error for it (with the > correct and consistent

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-12 Thread Stefan Behnel
Stefan Behnel added the comment: I do not see this as a matter of performance but as a matter of usability. Basically, CPython could do just fine with just a single catch-all calling convention that packs all pos/kw arguments into C arguments and passes them over, leaving it entirely to the

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-12 Thread STINNER Victor
STINNER Victor added the comment: Here are benchmark results. Sorry, but I'm not really convinced that this specialization is worth it. The change adds yet another calling convention where we already have METH_NOARG, METH_VARARGS, METH_O, METH_NOARG | METH_KEYWORDS, METH_FASTCALL... I'm ok

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-05 Thread Stefan Krah
Stefan Krah added the comment: For third party projects who want to use FASTCALL the functions are not generated by AC. I didn't understand the reasoning why the consistency argument is weak. -- ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Actually these arguments are pretty weak. The sole argument of consistency is weak itself. _PyArg_NoStackKeywords() is pretty cheap since implementing it as a macro. This change just moves the check from the implementation of functions to the calling place.

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Victor, could you please rerun benchmarks and check whether this change cause performance degradation? -- ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-05 Thread Stefan Krah
Stefan Krah added the comment: > I'd like to use METH_FASTCALL in Cython in a future-proof way. Also +1. Can we consider the API frozen after this issue or do we have to wait for #29465 (or others)? -- ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +2026 ___ Python tracker ___ ___

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Proposed patch renames METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS > and makes bare METH_FASTCALL be used for functions with > positional-only parameters. This eliminates small cost that > these functions pay for handling empty keywords: calling >

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-06-05 Thread Stefan Behnel
Stefan Behnel added the comment: I looked up this change again and was surprised that it still wasn't applied. It feels to me that it makes sense already for reasons of consistency. Any time frame for changing it? I'd like to use METH_FASTCALL in Cython in a future-proof way. --

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-03-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Proposed patch renames METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS > and makes bare METH_FASTCALL be used for functions with > positional-only parameters. +1 -- nosy: +rhettinger ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-03-04 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : Added file: http://bugs.python.org/file46699/fastcall-no-keywords-3.patch ___ Python tracker ___

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-07 Thread STINNER Victor
STINNER Victor added the comment: Serhiy Storchaka: "I prefer to delay pushing the patch until we prove its usefulness, because the cost of this change is not zero. Is it a stopper for issue29465?" Ok. No, it's not a blocker for my issue #29465. About usefulness, I'm curious of the

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The major part of the patch is generated by Argument Clinic. It is not a pain to rebase it. I prefer to delay pushing the patch until we prove its usefulness, because the cost of this change is not zero. Is it a stopper for issue29465? -- assignee:

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-07 Thread STINNER Victor
STINNER Victor added the comment: Ok, so I looked again at your change: fastcall-no-keywords-2.patch LGTM, I like the idea! Since your patch is huge, I expect that it will be a pain to rebase it. I suggest you to push it as soon as possible, to avoid conflicts. I will rework my issue #29465

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There was a bug in previous patch. The signature of generated by Argument Clinic functions was not changed. Updated patch fixes this bug and also fixes the use of fast call in deque methods. -- Added file:

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread Stefan Behnel
Stefan Behnel added the comment: Thanks for asking. Cython doesn't use METH_FASTCALL yet, so this doesn't introduce any problems. Generally speaking, if Cython generated user code stops working with a new CPython version, we expect people to regenerate their code with the newest Cython

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread STINNER Victor
STINNER Victor added the comment: Hum, benchmark results don't seem good. There is probably a performance bug somewhere. I should investigate further to analyze these results. M aybe combined with the issue #29465, results will be better. haypo@speed-python$ python3 -m perf compare_to

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread STINNER Victor
STINNER Victor added the comment: I measured the stack consumption, it's not better. But I created the issue #29465 "Add _PyObject_FastCall() to reduce stack consumption" which would allow to reduce the stack consumption with this patch. -- ___

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread STINNER Victor
STINNER Victor added the comment: > We can avoid breaking backward compatibility and introduce new call method > METH_FASTCALL_NO_KEYWORDS. But combining existing flags looks better to me. > FASTCALL is not a part of stable ABI. If we decide that having two FASTCALL calling convention, I

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread Stefan Krah
Stefan Krah added the comment: Adding Stefan Behnel, perhaps Cython doesn't need backwards compatibility. -- nosy: +scoder, skrah ___ Python tracker ___

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread STINNER Victor
STINNER Victor added the comment: > I still didn't do any benchmarking or stack usage measurements. I'm running benchmarks on the speed-python server. -- ___ Python tracker

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: We can avoid breaking backward compatibility and introduce new call method METH_FASTCALL_NO_KEYWORDS. But combining existing flags looks better to me. FASTCALL is not a part of stable ABI. I still didn't do any benchmarking or stack usage measurements.

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread STINNER Victor
STINNER Victor added the comment: > Proposed patch renames METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and makes > bare METH_FASTCALL be used for functions with positional-only parameters. While I tried to keep everything related to FASTCALL private, it seems like Cython uses some FASTCALL

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch renames METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and makes bare METH_FASTCALL be used for functions with positional-only parameters. This eliminates small cost that these functions pay for handling empty keywords: calling

[issue29464] Specialize FASTCALL for functions with positional-only parameters

2017-02-06 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +haypo ___ Python tracker ___ ___