[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2022-01-21 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> AFAIK we have committed _PyArg_UnpackKeywordsWithVararg on 3.11 alpha, so I 
> think it should be fine.

I see, so no ABI worries then.

--

___
Python tracker 

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



[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2022-01-21 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> Note that _PyArg_UnpackKeywordsWithVararg is defined with PyAPI_FUNC. 
> Changing its argument spec is strictly a backwards incompatible change, IIUC.

AFAIK we have committed _PyArg_UnpackKeywordsWithVararg on 3.11 alpha, so I 
think it should be fine. Also CC: @pablogsal

--
nosy: +pablogsal

___
Python tracker 

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



[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2022-01-04 Thread colorfulappl


colorfulappl  added the comment:

I am a rookie in Python, did not notice changing PyAPI_FUNC means breaking 
backward compatibility.

I have reverted _PyArg_UnpackKeywordsWithVararg and committed again.

--

___
Python tracker 

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



[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2021-12-31 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Note that _PyArg_UnpackKeywordsWithVararg is defined with PyAPI_FUNC. Changing 
its argument spec is strictly a backwards incompatible change, IIUC.

--
nosy: +BTaskaya

___
Python tracker 

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



[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2021-12-31 Thread colorfulappl


colorfulappl  added the comment:

I wrote some microbenchs.

Patch: 
https://github.com/python/cpython/pull/30312/commits/b68176d081e19a3cedbaf2cdb31ecd7690421ec8

Environment:
macOS 12.1
clang 13.0.0
configure with --enable-optimizations

Result on microbench:

```
++-++
| Benchmark  | ./opt_baseline/res.json | 
./opt_patched/res.json |
++=++
| print(a, b, c) | 917 ns  | 820 
ns: 1.12x faster   |
++-++
| print(a, b, c, *v) | 1.56 us | 1.62 
us: 1.04x slower  |
++-++
| print(a, sep='', file=stdout)  | 376 ns  | 295 
ns: 1.27x faster   |
++-++
| print(*v, sep='', flush=True, file=stdout) | 2.02 us | 1.94 
us: 1.04x faster  |
++-++
| Geometric mean | (ref)   | 1.05x 
faster   |
++-++

Benchmark hidden because not significant (3): print(a), print(a, sep='', 
flush=True, file=stdout), print(a, b, c, *v, sep='', flush=True, file=stdout)
```

--
Added file: https://bugs.python.org/file50533/bench-print.py

___
Python tracker 

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



[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2021-12-31 Thread colorfulappl


Change by colorfulappl :


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

___
Python tracker 

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



[issue46212] Avoid temporary `varargs` tuple creation in argument passing

2021-12-31 Thread colorfulappl


New submission from colorfulappl :

When "Augument Clinic generated code" are parsing arguments, the args are 
packed to a tuple before passing to callee. This may be unnecessary.

Pass a raw pointer which points to on-stack varargs, and a varargssize integer 
to indicate how many varargs are passed, can save the time of tuple 
creation/destruction and value copy.

--
components: Argument Clinic
messages: 409412
nosy: colorfulappl, erlendaasland, larry
priority: normal
severity: normal
status: open
title: Avoid temporary `varargs` tuple creation in argument passing
type: performance
versions: Python 3.11

___
Python tracker 

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