3 ms·
BTW, Mutex::get_mut exists and safely gives access without locking, when you can prove to the borrow checker that you have the only reference to the Mutex.
by pornel 5y ago
BTW, Mutex::get_mut exists and safely gives access without locking, when you can prove to the borrow checker that you have the only reference to the Mutex.
- jerf 5y agoAn example of one of the little reasons I expect large-scale Rust code to be faster than C++ in the long term. There's a lot of little things like this that the Rust can do but C++ can't that can add up to a lot over the entire program. But it's really hard to see these in benchmarks because benchmarks are almost never code complicated enough to show these differences, and then even if someone writes one, in the resulting benchmark competition someone may come in and hand-optimize the C++ code for this. But C++ can't scale that sort of attention, so the benchmarked performance won't be anything that real code can obtain.