News for hackers. Stuff that matters.
Re:Rust is not fast by kibwen on Tuesday November 19, 2013 @11:35AM (#6762294)
> I'm glad to hear Rust is all wonderful now.

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.

Re:Rust is not fast by mscottmcbee on Tuesday November 19, 2013 @12:11PM (#6762570)
>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.

Ouch, I didn't know the project had a deadline. By when does it need to be faster?

Re:Rust is not fast by pcwalton on Tuesday November 19, 2013 @12:21PM (#6762668)
kibwen is not speaking for the Rust team.
Re:Rust is not fast by kibwen on Tuesday November 19, 2013 @12:25PM (#6762701)
Indeed I'm not! Just an over-enthusiastic community member here. :)
Re:Rust is not fast by mscottmcbee on Tuesday November 19, 2013 @12:52PM (#6762942)
Ok, that makes me feel better. I've been watching and waiting for Windows support to get better, and I'd hate to have it fizzle before I really got to play with it.
Re:Rust is not fast by cscottnet on Wednesday November 20, 2013 @12:15AM (#6766437)
re: find_or_insert

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.)

Re:Rust is not fast by dbaupp on Wednesday November 20, 2013 @05:18PM (#6771611)
If that's the problem, it's really rather easy to define a wrapper that only clones on an insert. (And, I fundamentally disagree that over-copying this is a pervasive issue; there are a few places (mainly old code) where unnecessary Clone-ing is performed, but this is very much the exception.)

  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)
  }