[issue41342] Convert int.__round__ to Argument Clinic

2020-07-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 5a2bac7fe0e7a2b67fd57c7a9176a50feed0d7a0 by Serhiy Storchaka in 
branch 'master':
bpo-41342: Convert int.__round__ to Argument Clinic (GH-21549)
https://github.com/python/cpython/commit/5a2bac7fe0e7a2b67fd57c7a9176a50feed0d7a0


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, you can do this without Argument Clinic, but Argument Clinic allows to 
hide the use of unstable private API and cumbersome code under macros and in 
generated files.

> That said, it would be great if someone were to work on building-out AC to 
> support more interesting argument patterns like those in round().

The problem is not only in Argument Clinic (and the Argument Clinic part is 
mainly solved). The problem is that currently it is not possible to express the 
signature of int.__round__() (and dict.get(), and getattr()) in Python syntax, 
and the inspect module does not support any non-Python syntax for this either. 
Once we invent the way to express it, supporting it in Argument Clinic will be 
merely technical problem.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I don't have an opinion on the PR but want to point-out the Argument Clinic 
itself doesn't provide a performance benefit.  Anything that it does can also 
be done directly by the code itself, including vectorcall logic.  You should be 
able to optimize the function calls without using the Argument Clinic.

That said, it would be great if someone were to work on building-out AC to 
support more interesting argument patterns like those in round().  Ideally, AC 
would provide complete, correct support right out of the box.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
Removed message: https://bugs.python.org/msg373973

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I don't have an opinion on the PR but want to point-out the Argument Clinic 
itself doesn't provide a performance benefit.  Anything that it does can also 
be done directly by the code itself, including vectorcall logic.  You should be 
able to optimize function calls without using the Argument Clinic.

That said, it would be great is someone were to work on building-out AC to 
support more interesting argument patterns like those in round().  It would be 
great if there were complete, correct support right out of the box.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-19 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +20691
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21549

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-19 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

int.__round__ was not converted to Argument Clinic because it is not impossible 
to express a correct signature for it in Python. But now we can at least make 
Argument Clinic not producing incorrect signature. And converting to Argument 
Clinic has a performance benefit.

$ ./python -m pyperf timeit -q --compare-to=../cpython-baseline/python 
"round(12345)"
Mean +- std dev: [/home/serhiy/py/cpython-baseline/python] 123 ns +- 6 ns -> 
[/home/serhiy/py/cpython-release/python] 94.4 ns +- 2.4 ns: 1.31x faster (-23%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-baseline/python 
"round(12345, 0)"
Mean +- std dev: [/home/serhiy/py/cpython-baseline/python] 159 ns +- 4 ns -> 
[/home/serhiy/py/cpython-release/python] 98.6 ns +- 2.4 ns: 1.61x faster (-38%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-baseline/python 
"round(12345, -2)"
Mean +- std dev: [/home/serhiy/py/cpython-baseline/python] 585 ns +- 9 ns -> 
[/home/serhiy/py/cpython-release/python] 534 ns +- 14 ns: 1.09x faster (-9%)

--
components: Argument Clinic, Interpreter Core
messages: 373963
nosy: larry, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Convert int.__round__ to Argument Clinic
type: performance
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com