Neil Schemenauer <nas-pyt...@arctrix.com> 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.  See pypref-trashcan2.txt for benchmark.  
Overall I think might be a bit slower (less than 1%?)  but we have gained 
trashcan protection for the dealloc of all GC objects.  

If we are okay with the performance, here are other questions to answer:

A) is it safe to untrack GC objects before calling tp_dealloc?

B) is it safe to have PyObject_CallFinalizerFromDealloc() track objects that 
are resurrected?


We might have to look at 3rd party extensions to decide on those.  I.e. maybe 
in theory it is not safe but in practice there is no extension code that would 
actually break.

----------
Added file: https://bugs.python.org/file50223/pyperf-trashcan2.txt

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

Reply via email to