[issue29736] Optimize builtin types constructor

2017-08-10 Thread STINNER Victor

STINNER Victor added the comment:

I lost interest in this issue. I closed my PR, now I close this old issue.

--
resolution:  -> out of date
stage:  -> 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



[issue29736] Optimize builtin types constructor

2017-03-21 Thread STINNER Victor

STINNER Victor added the comment:

The following types were patched to use Argument Clinic (use now 
_PyArg_ParseTupleAndKeywordsFast or don't accept keyword arguments anymore):

* complex
* float (don't accept keywords anymore)
* list
* tuple

The following types still uses PyArg_ParseTupleAndKeywords:

* bytes
* bytearray
* int (PyLong)
* str (unicode_new)

bool doesn't accept keywords anymore and uses now PyArg_UnpackTuple().

--

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And include bytearray.

--

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-19 Thread STINNER Victor

STINNER Victor added the comment:

Ok, will do.

--

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Victor, could you please rebase your PR? And maybe rerun benchmarks?

--

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Actually there is an issue with using Argument Clinic for constructors. I wrote 
a patch that fixes it and converts constructors of basic types to Argument 
Clinic a half year ago, but it was not finished and published due to focusing 
on 3.6. I'll update and publish it soon.

--

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

float, list: issue20185.

--

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

> I would wait until constructors be converted to Argument Clinic. There are 
> ready patches for some of these builtin types, patches for other are in 
> proggress.

Do you have links for these changes? It's painful to search for Argument Clinic 
changes, the issue title doesn't say anything except "derby " :-/

--

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The half of constructors no longer use PyArg_ParseTupleAndKeywords().

I would wait until constructors be converted to Argument Clinic. There are 
ready patches for some of these builtin types, patches for other are in 
proggress.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-06 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +429

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-06 Thread STINNER Victor

New submission from STINNER Victor:

Attached PR replaces PyArg_ParseTupleAndKeywords() with
_PyArg_ParseTupleAndKeywordsFast() to optimize the constructor of the
builtin types:

* bool: bool_new()
* bytes: bytes_new()
* complex: complex_new()
* float: float_new()
* int: long_new()
* list: list_init()
* str: unicode_new()
* tuple: tuple_new()

When using keywords, the speedup is between 1.55x faster and 1.92x faster.

When using only positional arguments, the speedup is between 1.07x faster and 
1.14x faster.

Results of attached bench.py:

+---++-+
| Benchmark | ref| changed |
+===++=+
| complex(real=0.0, imag=0.0)   | 452 ns | 1.92x faster (-48%) |
+---++-+
| bytes("x", encoding="ascii", errors="strict") | 498 ns | 1.88x faster (-47%) |
+---++-+
| str(b"x", encoding="ascii")   | 340 ns | 1.55x faster (-35%) |
+---++-+
| list([None])  | 208 ns | 1.14x faster (-12%) |
+---++-+
| int(0)| 113 ns | 1.11x faster (-10%) |
+---++-+
| float(1.0)| 110 ns | 1.10x faster (-9%)  |
+---++-+
| str("x")  | 115 ns | 1.10x faster (-9%)  |
+---++-+
| tuple((None,))| 111 ns | 1.10x faster (-9%)  |
+---++-+
| bytes(b"x")   | 126 ns | 1.10x faster (-9%)  |
+---++-+
| bool(True)| 107 ns | 1.09x faster (-8%)  |
+---++-+
| complex(0.0, 0.0) | 176 ns | 1.07x faster (-7%)  |
+---++-+

--
files: bench.py
messages: 289111
nosy: haypo
priority: normal
severity: normal
status: open
title: Optimize builtin types constructor
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file46705/bench.py

___
Python tracker 

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