Conversation
Copy link
Copy Markdown
Member
- Previously GC tracking was disabled for structs with
nogc=True, but kept the same GC-enabled memory layout. This PR changes nogc structs to truly be non-GC types. This reduces memory usage per instance by 16 bytes. It also letsdictandtupleinstances containingnogc=Truestructs to also not be tracked instances, further reducing GC load. - Further optimize the allocation code paths for structs. We now no longer needless track structs just to untrack them later, resulting in a micro speedup. We also optimize at import time
tp_setattrandtp_free, rather than branching per-call. - Add a benchmark for GC usage comparing structs, structs with nogc=True, classes, and classes with
__slots__. This shows a major reduction in GC pause time for applications with a large number of in-memoryStructinstances. - Improve documentation for
nogcstructs.