4 ms·
I can't speak to the reference counting and garbage collection libraries (which are likely the items to which you are mainly referring), but I found Rust's appr
by portmanteaufu 13y ago
I can't speak to the reference counting and garbage collection libraries (which are likely the items to which you are mainly referring), but I found Rust's approach to the more mundane memory management scenarios to be enormously refreshing.
When writing Rust, you simply tag those variables that the current thread of execution is responsible for free()ing when they go out of scope. The compiler enforces correctness and can tell when you've tried to use a variable that's no longer available. There's no such thing as an invalid memory reference and so long as you avoid using a GC library, there's no overhead whatsoever. When the compiler's happy, you can rest assured that your program is free from entire classes of subtle bugs that can lie in wait for years before you get your first segfault.
The Rust team has admittedly put very little time into optimizations at this stage. However, Rust's manual memory management combined with LLVM's existing optimizations have put its performance on par with C in several (simple) benchmarks. In others, it can be found somewhere between C and Go. That's quite a feat for so young a language.
Forgive my gushing. I'm very excited to finally have C speed and high level language features without segfaults.