[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-04-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 973c9ec53bbb by Serhiy Storchaka in branch 'default':
Fixed the array module broken in issue #23492.
https://hg.python.org/cpython/rev/973c9ec53bbb

--

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-04-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e10ad4d4d490 by Serhiy Storchaka in branch 'default':
Issue #23492: Argument Clinic now generates argument parsing code with
https://hg.python.org/cpython/rev/e10ad4d4d490

--
nosy: +python-dev

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-04-03 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


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

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
components: +Argument Clinic

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-22 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Let's make Argument Clinic a fierce optimizer!
(+1 on this)

--
nosy: +pitrou

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-22 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka
dependencies: +Argument Clinic: generate code into separate files by default

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-21 Thread Stefan Behnel

Stefan Behnel added the comment:

Serhiy, I suggest you look at the code that Cython generates for its functions. 
It has been extensively profiled and optimised (years ago), so generating the 
same code for the argument clinic should yield the same performance.

And while I don't have exact numbers at hand, avoiding the tuple packing for 
the call by passing it into a METH_O function can make a substantial 
difference. It also kills support for keyword arguments, though.

--
nosy: +scoder

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-21 Thread Larry Hastings

Larry Hastings added the comment:

Stefan: Serhiy's patch only affects functions taking a single positional-only 
parameter.

--

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Serhiy, I suggest you look at the code that Cython generates for its 
 functions. It has been extensively profiled and optimised (years ago), so 
 generating the same code for the argument clinic should yield the same 
 performance.

Thanks, I'll look on it.

 And while I don't have exact numbers at hand, avoiding the tuple packing for 
 the call by passing it into a METH_O function can make a substantial 
 difference.

Good idea. Here are samples:

$ ./python -m timeit chr(0x20ac)
Unpatched: 100 loops, best of 3: 0.976 usec per loop
Patched:   100 loops, best of 3: 0.752 usec per loop

$ ./python -m timeit -s from cmath import isnan; x = 1j -- isnan(x)
Unpatched: 100 loops, best of 3: 0.62 usec per loop
Patched:   100 loops, best of 3: 0.386 usec per loop

Of course for more complex functions the effect is smaller.

--

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-21 Thread Larry Hastings

Larry Hastings added the comment:

lgtm

--

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

After expanding PyArg_Parse for i and D codes above tests give following 
results:

$ ./python -m timeit chr(0x20ac)
100 loops, best of 3: 0.558 usec per loop

$ ./python -m timeit -s from cmath import isnan; x = 1j -- isnan(x)
100 loops, best of 3: 0.278 usec per loop

About twice in comparison with initial variant!

--

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-20 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch improve generated parsers for functions with single positional 
argument. Now they always generated as METH_O and PyArg_Parse() is used to 
parse single argument.

To avoid code churn in this and following changes it would be worth to extract 
all generated code in separated files.

--
components: Build
files: clinic_meth_o.patch
keywords: patch
messages: 236288
nosy: larry, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Argument Clinic: improve generated parser for 1-argument functions
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file38188/clinic_meth_o.patch

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-20 Thread Josh Rosenberg

Changes by Josh Rosenberg shadowranger+pyt...@gmail.com:


--
nosy: +josh.r

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-20 Thread Larry Hastings

Larry Hastings added the comment:

I'm not opposed to the patch in principle.  I assume your goal is to make 
Python faster--do you have any data on how much faster?

I don't support immediately changing all uses of Argument Clinic to generate 
their code into a separate file.  I would want to see a consensus from the 
community first.  Perhaps we should discuss it (again?) on python-dev?

--

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is one step on long way. Second step will be to inline PyArg_Parse for 
some format codes (i, U, y*, O, O!). Then we could try to expand 
PyArg_ParseTuple, at least for simple common cases. Then 
PyArg_ParseTupleAndKeywords. All this step will produce large diffs for 
generated code.

--

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