by kibwen · 13y ago · 0 comments
Nope, we're not saying that yet, Rust still needs a ton of work!
> How does Rust handle "find_and_insert" now?
Google doesn't return any obvious results for this string, what is it supposed to do?
> is Rust supposed to be 'safe and fast'? Or just 'safe'?
If Servo (written in Rust) isn't faster than Gecko (written in C++), then Mozilla won't continue funding Rust. Rust needs to be fast in a very existential way. :) And it will be! Initial benchmarks of Servo's performance are incredibly promising (pcwalton could go into more detail here), and there's still bushels of low-hanging fruit to be plucked.
Ouch, I didn't know the project had a deadline. By when does it need to be faster?
http://static.rust-lang.org/doc/0.8/std/hashmap/struct.HashM...
It appears to still have the mandatory copy. (And this is just one example of a pervasive issue with the standard library.)
fn find_or_insert_clone<'a, K: Clone, V>(map: &'a mut HashMap<K,V>,
key: &K, val: V) -> &'a mut V {
match map.find_mut(key) {
Some(x) => return x,
None => {}
}
// `key` is definitely missing
map.find_or_insert(key.clone(), val)
}