On 2018-09-12, Victor Stinner wrote:
Amazing! Now I want your code in my http://github.com/pythoncapi/cpython/ fork! Please send me a PR!
I tried yesterday to port my changes to your branch. They don't work because of the hiding of Py_TYPE behind the limited API macro. So, porting to your branch is non-trival. It will take me some time. I would like to do more benchmarking as people are already making conclusions based on my bad benchmarks.
The changes to the C-API needed to make this work are relatively simple. Using Py_TYPE is the big one. Source code fixes can be automated (with Coccinelle or some other tool). So, I think this doesn't have to wait for the full C-API redesign to mature. Fixing extensions that use borrowed references is a lot harder.
My dream now is to add a 'configure' option that would turn on tagged pointers for small ints. If you turn that on, extensions accessing PyObject struct members would break. However, it would be a nicely modular option: turn if off and there should be zero performance hit. Turn it on and, from an outside perspective, Python still works as normal. So, type(<fixedint>) would return 'int'. The fixedint stuff would be a hidden implementation detail.
Regards,
Neil