jcrist · GitHub

Conversation

@jcrist

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 lets dict and tuple instances containing nogc=True structs 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_setattr and tp_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-memory Struct instances.
  • Improve documentation for nogc structs.

@jcrist

@jcrist

Labels

None yet

1 participant

@jcrist

Read the original on github.com ↗