[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-16 Thread STINNER Victor
STINNER Victor added the comment: I ran benchmarks on speed.python.org, it's the 5bb146aaea1484bcc117ab6cb38dda39ceb5df0f dot (Jan 13, 2019). I didn't look at results. -- ___ Python tracker ___

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I do not expect significant changes in higher-level benchmarks. But if there are some, they can be shown on speed.python.org. I this all work on this stage is finished. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 793426687509be24a42663a27e568cc92dcc07f6 by Serhiy Storchaka in branch 'master': bpo-35582: Inline arguments tuple unpacking in handwritten code. (GH-11524) https://github.com/python/cpython/commit/793426687509be24a42663a27e568cc92dcc07f6 --

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: Are there any numbers on higher-level benchmarks? -- nosy: +pitrou ___ Python tracker ___ ___ Pyt

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Just inlining the arg tuple unpacking in iter() give only 10% speed up. I would not apply this optimization for such small difference. But with converting it to fast call it looks more interesting. -- ___ Python

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor
STINNER Victor added the comment: $ ./python -m timeit "iter(())" Unpatched: 500 loops, best of 5: 82.8 nsec per loop Patched:500 loops, best of 5: 56.3 nsec per loop That's quite significant. Oh, it's because you converted builtin_iter() from METH_VARARGS to METH_FASTCALL at the

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Stefan Behnel
Stefan Behnel added the comment: Nice! Well done, Serhiy! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 11524 performs the same kind of changes as PR 11520, but for handwritten code (only if this causes noticeable speed up). Also iter() is now use the fast call convention. $ ./python -m timeit "iter(())" Unpatched: 500 loops, best of 5: 82.8 nsec per

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +11104, 11105, 11106 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +11104, 11105 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +11104 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 2a39d251f07d4c620e3b9a1848e3d1eb3067be64 by Serhiy Storchaka in branch 'master': bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (GH-11520) https://github.com/python/cpython/commit/2a39d251f07d4c620e3b9a1848e3d1eb3067be64

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor
STINNER Victor added the comment: $ ./python -m timeit -s "from operator import add" "add(1, 2)" Unpatched: 500 loops, best of 5: 40.7 nsec per loop Patched:1000 loops, best of 5: 32.6 nsec per loop We should stop you, or the timing will become negative if you continue! -

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 11520 additionally replaces PyArg_UnpackTuple() and _PyArg_UnpackStack() with _PyArg_CheckPositional() and inlined code in Argument Clinic. Some examples for PR 11520: $ ./python -m timeit "'abc'.strip()" Unpatched: 500 loops, best of 5: 51.2 nsec

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor
STINNER Victor added the comment: > I can trigger a benchmark run on speed.python.org once the change is merged. Aha, it seems like Serhiy has more optimizations to come: PR #11520. @Serhiy: tell me when you are done, so I can trigger a new benchmark run. --

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor
STINNER Victor added the comment: I converted msg333446 into attached bench.py using perf. Results on my laptop: vstinner@apu$ ./python -m perf compare_to ref.json inlined.json --table -G +-+-+--+ | Benchmark | ref |

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +11095, 11096, 11097 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +11095 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +11095, 11096 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 4fa9591025b6a098f3d6402e5413ee6740ede6c5 by Serhiy Storchaka in branch 'master': bpo-35582: Argument Clinic: inline parsing code for positional parameters. (GH-11313) https://github.com/python/cpython/commit/4fa9591025b6a098f3d6402e5413ee6740

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Stefan Behnel
Stefan Behnel added the comment: It might be worth inlining a fast path of "_PyArg_CheckPositional()" that only tests "nargs < min || nargs > max" (even via a macro), and then branches to the full error checking and reporting code only if that fails. Determining the concrete exception to rai

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Stefan Behnel
Change by Stefan Behnel : -- nosy: +scoder -scode ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Added Stefan because the new C API could be used in Cython after stabilizing. We should more cooperate with Cython team and provide a (semi-)official stable API for using in Cython. I do not expect large affect on most tests, since this optimization affect

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor
STINNER Victor added the comment: I can trigger a benchmark run on speed.python.org once the change is merged. -- ___ Python tracker ___ __

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Is it possible to run custom builds or benchmark of this once merged on speed.python.org ? I hope this give will be a noticeable dip in the benchmark graphs. -- nosy: +xtreak ___ Python tracker

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I suppose that my computer is a bit faster than your, so your 20 ns can be only 15 ns or 10 ns on my computer. Run microbenchmarks on your computer to get a scale. It may be possible to save yet few nanoseconds if inline a fast path for _PyArg_CheckPositi

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor
STINNER Victor added the comment: $ ./python -m timeit "format('abc')" Unpatched: 500 loops, best of 5: 65 nsec per loop Patched:500 loops, best of 5: 42.4 nsec per loop -23 ns on 65 ns: this is very significant! I spent like 6 months to implement "FASTCALL" to avoid a single tup

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Some examples: $ ./python -m timeit "format('abc')" Unpatched: 500 loops, best of 5: 65 nsec per loop Patched:500 loops, best of 5: 42.4 nsec per loop $ ./python -m timeit "'abc'.replace('x', 'y')" Unpatched: 500 loops, best of 5: 101 nsec

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-06 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +10903, 10904 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-06 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +10903 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-05 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2018-12-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch, patch, patch pull_requests: +10562, 10563, 10564 stage: -> patch review ___ Python tracker ___ __

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2018-12-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch, patch pull_requests: +10562, 10563 stage: -> patch review ___ Python tracker ___

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2018-12-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +10562 stage: -> patch review ___ Python tracker ___ ___ Python-bug

[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2018-12-25 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : This is a continuation of issue23867. The proposed PR makes Argument Clinic inlining parsing code for functions with only positional parameters, i.e. functions that use PyArg_ParseTuple() and _PyArg_ParseStack() now. This saves time for parsing format st