3 ms·
Python uses reference counting with a backup garbage collector just to pick up unreachable sets of object having circular references.
by todd8 9y ago
Python uses reference counting with a backup garbage collector just to pick up unreachable sets of object having circular references.
- __s 9y agoPython is slow & CPython is ever slower because reference counting is part of what makes removing the GIL such a challenge
- dfox 9y agoThe hard part of removing GIL are the language semantics themselves. Replacing CPython's reference counting with some kind of tracing GC will still leave you with problem of coming up with low-overhead thread-safe dictionary implementation.
- hyperpape 9y agoI agree with the first sentence. For the second part, what are you thinking of? For reads, there's very low overhead for using an implementation like Java's ConcurrentHashMap. The overhead for insertions is more significant, but not enormous.
- johncolanduoni 9y ago> reference counting is part of what makes removing the GIL such a challenge Interesting, I would have expected that switching reference counting to atomic operations would be pretty trivial. What about CPython's design complicates this?
- gpderetta 9y agoPretty trivial. Also pretty expensive.