[issue41334] Convert str(), bytes() and bytearray() 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



[issue41334] Convert str(), bytes() and bytearray() to Argument Clinic

2020-07-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 12f433411bba8a0cdc4f09ba34472745ae9da0d1 by Serhiy Storchaka in 
branch 'master':
bpo-41334: Convert constructors of str, bytes and bytearray to Argument Clinic 
(GH-21535)
https://github.com/python/cpython/commit/12f433411bba8a0cdc4f09ba34472745ae9da0d1


--

___
Python tracker 

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



[issue41334] Convert str(), bytes() and bytearray() to Argument Clinic

2020-07-18 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue41334] Convert str(), bytes() and bytearray() to Argument Clinic

2020-07-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue41334] Convert str(), bytes() and bytearray() to Argument Clinic

2020-07-18 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Constructors str(), bytes() and bytearray() were not converted to Argument 
Clinic because it was not possible to generate correct signature for them. But 
now there is other reason of using Argument Clinic -- it generates more 
efficient code for parsing arguments.

The proposed PR converts str(), bytes() and bytearray() to Argument Clinic but 
generated docstrings are not used.

$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python "str()"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 81.9 ns +- 4.5 ns -> 
[/home/serhiy/py/cpython-release/python] 60.0 ns +- 1.9 ns: 1.36x faster (-27%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"str('abcdefgh')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 121 ns +- 3 ns -> 
[/home/serhiy/py/cpython-release/python] 87.6 ns +- 2.8 ns: 1.38x faster (-28%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"str(12345)"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 188 ns +- 8 ns -> 
[/home/serhiy/py/cpython-release/python] 149 ns +- 5 ns: 1.27x faster (-21%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"str(b'abcdefgh', 'ascii')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 210 ns +- 7 ns -> 
[/home/serhiy/py/cpython-release/python] 164 ns +- 6 ns: 1.28x faster (-22%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"str(b'abcdefgh', 'ascii', 'strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 222 ns +- 9 ns -> 
[/home/serhiy/py/cpython-release/python] 170 ns +- 6 ns: 1.30x faster (-23%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"str(b'abcdefgh', encoding='ascii', errors='strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 488 ns +- 20 ns -> 
[/home/serhiy/py/cpython-release/python] 306 ns +- 5 ns: 1.59x faster (-37%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python "bytes()"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 85.1 ns +- 2.2 ns -> 
[/home/serhiy/py/cpython-release/python] 60.2 ns +- 2.3 ns: 1.41x faster (-29%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytes(8)"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 160 ns +- 5 ns -> 
[/home/serhiy/py/cpython-release/python] 115 ns +- 4 ns: 1.39x faster (-28%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytes(b'abcdefgh')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 131 ns +- 6 ns -> 
[/home/serhiy/py/cpython-release/python] 91.0 ns +- 2.8 ns: 1.43x faster (-30%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytes('abcdefgh', 'ascii')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 190 ns +- 6 ns -> 
[/home/serhiy/py/cpython-release/python] 144 ns +- 5 ns: 1.32x faster (-24%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytes('abcdefgh', 'ascii', 'strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 214 ns +- 5 ns -> 
[/home/serhiy/py/cpython-release/python] 156 ns +- 4 ns: 1.37x faster (-27%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytes('abcdefgh', encoding='ascii', errors='strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 442 ns +- 9 ns -> 
[/home/serhiy/py/cpython-release/python] 269 ns +- 8 ns: 1.64x faster (-39%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray()"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 93.5 ns +- 2.1 ns -> 
[/home/serhiy/py/cpython-release/python] 73.1 ns +- 1.8 ns: 1.28x faster (-22%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray(8)"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 154 ns +- 3 ns -> 
[/home/serhiy/py/cpython-release/python] 117 ns +- 3 ns: 1.32x faster (-24%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray(b'abcdefgh')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 164 ns +- 5 ns -> 
[/home/serhiy/py/cpython-release/python] 131 ns +- 2 ns: 1.25x faster (-20%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray('abcdefgh', 'ascii')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 239 ns +- 7 ns -> 
[/home/serhiy/py/cpython-release/python] 193 ns +- 4 ns: 1.24x faster (-19%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray('abcdefgh', 'ascii', 'strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 260 ns +- 5 ns -> 
[/home/serhiy/py/cpython-release/python] 207 ns +- 10 ns: 1.26x faster (-21%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray('abcdefgh', encoding='ascii', errors='strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 505 ns +- 11 ns ->