24 ms·
Nim, while providing the same memory safety as Rust, doesn't do so without overhead. So Nim very expressly sacrifices performance for safety. In rust, for exam
by TheNorthman 4y ago
Nim, while providing the same memory safety as Rust, doesn't do so without overhead. So Nim very expressly sacrifices performance for safety.
In rust, for example, it's possible to safely share data between threads without incurring costs of a garbage collector. Nim uses a different GC for each thread, so it naturally increases costs on a per-thread basis.
- planetis 4y agoNo more GC in Nim now there is an optional cycle collector https://nim-lang.org/blog/2020/12/08/introducing-orc.html https://nim-lang.org/blog/2020/12/08/introducing-orc.html it also offers experimental view types.
- TheNorthman 4y agoI was sort of vaguely aware of this but thank you for pointing it out! I think the point still stands, and that reference counting like this is just a different kind of garbage collection.
- planetis 4y agoIt's not exactly like that there is cursor inference and copy elision. But ok...
- frigid 4y agoIt certainly adds (some, not many thanks to static analysis) runtime checks, but it's also fairly distinguished from typical tracing garbage collection by being deterministic. I believe ARC/ORC also works with a shared heap via "isolated" data.
- hayley-patton 4y agoThat's correct; there are two chapters of the GC Handbook on reference counting, and ye olde unified theory of garbage collection <https://dl.acm.org/doi/10.1145/1028976.1028982 https://dl.acm.org/doi/10.1145/1028976.1028982>.