New submission from Joe Jevnik:

When star unpacking positions into a function we can avoid a copy iff there are 
no extra arguments coming from the stack. Syntactically this looks like: 
`f(*args)`

This reduces the overhead of the call by about 25% (~30ns on my machine) based 
on some light profiling of just * unpacking. I can imagine this having a slight 
impact on code that uses this feature in a loop.

The cost is minimal when we need to make the copy because the int != 0 check is 
dwarfed by the allocation. I did not notice a significant change between the 
slow path and the original code.

The macro benchmark suite did not show a difference on my machine but this is 
not much more complex code.

----------
components: Interpreter Core
files: call-function-var.patch
keywords: patch
messages: 263702
nosy: llllllllll
priority: normal
severity: normal
status: open
title: Avoid copy in call_function_var when no extra stack args are passed
versions: Python 3.6
Added file: http://bugs.python.org/file42512/call-function-var.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26802>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to