|
|
|
|
|
by dimfeld
3794 days ago
|
|
It's both faster and you have more control over it; the two are linked in this case. This system lets the compiler do the hard work to figure out when it's ok to deallocate some piece of memory, unlike a GC, which figures it out at runtime. One you've determined that some memory can be deallocated, the actual process is very quick, usually just updating a list of free blocks in the memory allocator and maybe some statistics. Rust does also support reference counting when you want it, which can bring its own set of performance issues in certain circumstances. Think more about general slowness due to constantly incrementing and decrementing references in an atomic fashion when you pass RC-ed data between functions, rather than the pauses seen with garbage collection. But how bad that is depends greatly on how and where you're using reference counted variables, and the addition of the lifetime/borrow system makes it easier to avoid some of the more egregious cases here. Additionally, some people are doing work on GCs that work with Rust. The two links below have some good descriptions of the progress and challenges related to that. http://blog.pnkfx.org/blog/2015/10/27/gc-and-rust-part-0-how...
http://manishearth.github.io/blog/2015/09/01/designing-a-gc-... |
|