3 ms·
It’s an interesting idea but not sure it works in all spaces. If the goal of something that you’re building is performance, it’s really really hard to convince
by vlovich123 4y ago
It’s an interesting idea but not sure it works in all spaces. If the goal of something that you’re building is performance, it’s really really hard to convince architectural and API missteps if you’re just liberally throwing around arc everywhere. Additionally, the amount of code you find out you have to rewrite is quite large. A better idea is to recognize where you’re bottlenecks are likely to be and where they’re not and use Rc is the clearly not case, be careful about it in the questionable cases and avoid it like the plague in the cases where it’s a problem.
unsafe { std::transmute(x) } is my favorite go to if I’m sure I have the lifetime mechanics sorted and don’t want to fight the borrow checker right now (oh, and usually the borrow checker is right and I think I’ve done this like maybe 2-3 times where it’s really impossible to convey to the compiler what I’m trying to do, at least with my knowledge of Rust)