[issue44897] Integrate trashcan mechanism into _Py_Dealloc

2021-08-16 Thread Neil Schemenauer
Change by Neil Schemenauer : -- nosy: +pablogsal, tim.peters, vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue44897] Integrate trashcan mechanism into _Py_Dealloc

2021-08-16 Thread Neil Schemenauer
Neil Schemenauer added the comment: Based on some testing, I think an extra type slot is not worth the extra complication. I made some small improvements to _Py_Dealloc and now the performance seems a bit better. Basically, I expanded _PyObject_IS_GC() to put the most common branches first

[issue44897] Integrate trashcan mechanism into _Py_Dealloc

2021-08-15 Thread Neil Schemenauer
Change by Neil Schemenauer : Added file: https://bugs.python.org/file50220/perf-annotate-trash.txt ___ Python tracker ___ ___ Python-bugs-li

[issue44897] Integrate trashcan mechanism into _Py_Dealloc

2021-08-15 Thread Neil Schemenauer
Neil Schemenauer added the comment: As I suspected, the performance impact is significant (although pretty small). Based on Linux perf, it looks like the extra test+branch in _Py_Dealloc adds about 1% overhead. pyperformance shows something similar, see attached reports (pypref-trashcan.tx

[issue44897] Integrate trashcan mechanism into _Py_Dealloc

2021-08-11 Thread Neil Schemenauer
Change by Neil Schemenauer : -- keywords: +patch pull_requests: +26218 pull_request: https://github.com/python/cpython/pull/27738 ___ Python tracker ___ ___

[issue44897] Integrate trashcan mechanism into _Py_Dealloc

2021-08-11 Thread Neil Schemenauer
New submission from Neil Schemenauer : This is a WIP/proof-of-concept of doing away with Py_TRASHCAN_BEGIN and Py_TRASHCAN_END and instead integrating the functionality into _Py_Dealloc. There are a few advantages: - all container objects have the risk of overflowing the C stack if a long r