[Cython] Skip tuple unpacking for func(*args, **kwargs)
Stefan Behnel
stefan_ml at behnel.de
Wed Feb 6 23:08:25 CET 2008
Hi,
here is another optimisation that removes argument unpacking for the
star-args-only case(s). This means that pass-through functions or wrappers
that do argument handling themselves or just pass it on to a wrapped function
will now run almost without internal overhead.
The generated code looks like this:
--------------------------------
Py_INCREF(__pyx_args);
__pyx_v_a = __pyx_args; __pyx_args = 0;
if (__pyx_kwds) {
Py_INCREF(__pyx_kwds);
__pyx_v_k = __pyx_kwds; __pyx_kwds = 0;
}
else {
__pyx_v_k = PyDict_New();
}
--------------------------------
plus straight sanity checks when you use only one out of *args -or- **kwargs.
Note that I'm actually setting __pyx_args/kwds to 0 here, to make sure we
notice programming errors.
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: package-upstream.bundle
Type: application/octet-stream
Size: 7443 bytes
Desc: not available
Url : http://codespeak.net/pipermail/cython-dev/attachments/20080206/c0f01337/attachment-0002.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: upstream.bundle
Type: application/octet-stream
Size: 3504 bytes
Desc: not available
Url : http://codespeak.net/pipermail/cython-dev/attachments/20080206/c0f01337/attachment-0003.obj
More information about the Cython-dev
mailing list