3 ms·
> * Everything is a Box<Rc<T>>. This is closest to dynamic garbage-collected languages, but with vastly improved performance. Wait, reference counting everythi
by jowea 3y ago
> * Everything is a Box<Rc<T>>. This is closest to dynamic garbage-collected languages, but with vastly improved performance.
Wait, reference counting everything all the time is faster than normal garbage collection?
- edflsafoiewq 3y agoIt's probably slower, but unlike normal GCed languages, it's not actually anywhere close to everything.
- riku_iki 3y agoI think more importantly it is reference counting across threads, meaning mutexes and breaking memory barrier with large performance penalty.
- MrRolleyes 3y agoI believe you're discussing 'Arc'. 'Rc' is not thread safe.
- riku_iki 3y agothen this is not "closest to GC languages", since GC langs usually provide memory management with respect to concurrency.
- MrRolleyes 3y ago[dead]
- MereInterest 3y agoMany garbage collectors (e.g. CPython’s) will use reference counting as part of the process. If a reference count hits zero, the object can be destructed, prolonging the time between mark-and-sweep passes. The performance difference, though, is mainly in switching over to a compiled language in the first place.