|
|
|
|
|
by nicoburns
142 days ago
|
|
The alternatives with the potential to be as fast (C, C++, D, zig) are more complex in this regard because they make memory safety and lifetime tracking something that you have to keep track of in your head. Rust's biggest win is removing that mental overhead while allowing you to achieve the same performance as those other languages. |
|
I.e. don't need to keep track of the memory for each allocation in my HTTP request and make sure I clean it up before closing the connection, I can just allocate some memory _per request_, put stuff in it, and at the end it gets cleaned up, whether I used the memory or not.
Some languages have the idea of "memory allocators" as a native construct, so that you can actually start thinking about managing memory in more sensible terms than "everything individually", e.g. Odin lang.