Skip to content

Improve nogc support - #93

Merged
jcrist merged 3 commits into
masterfrom
true-nogc
Mar 31, 2022
Merged

Improve nogc support#93
jcrist merged 3 commits into
masterfrom
true-nogc

Conversation

@jcrist

@jcrist jcrist commented Mar 31, 2022

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 merged commit 7d11c60 into master Mar 31, 2022
@jcrist
jcrist deleted the true-nogc branch March 31, 2022 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant