hydroflask <hydrofl...@yqxmail.com> added the comment:

@corona10

Thank you for looking into it.

The benchmark you did is not reflective of my use-case. I have a codebase that 
I have completely converted into a C extension using mypyc. So the ctypes 
callback does not call into interpreted Python code but actually another 
C-extension. I have annotated types aggressively to avoid invoking malloc(). In 
this use-case the extra overhead from the tuple allocation would be significant.

Additionally your benchmark may not be as micro as intended. You call some math 
in the callback function which may have made the savings from avoiding the 
tuple allocation seem more like noise.

Since you already did the work I still think it's worth putting it in since 
PyObject_Vectorcall is an established API and it would have been used anyway if 
this were written from scratch.

----------

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

Reply via email to