4 ms·
> in a typical language you can easily pass by reference between components and threads. and that's when you usually get data races ;) > In rust the unspoken
by drogus 4y ago
> in a typical language you can easily pass by reference between components and threads.
and that's when you usually get data races ;)
> In rust the unspoken rule seems to be to allocate, allocate, allocate - unless you are writing a special purpose library etc. Which makes me wonder, is rust actually faster than a GC'd language when doing heavy async work?
I think it's a bit more nuanced. `Arc` is still a "smart pointer", so while it's not a straight Rust reference, it acts as a pointer. Yes, it allocates and it needs to do a reference count, but the overhead is very small. So while in practice it is not "zero cost", it's usually negligible.