On 6/20/14 11:02 AM, Josh Haberman wrote:
Is there any reasonable scenario under which the compiler could decide to allocate stack space to cache that lookup, so that the code above would be optimized to only perform one lookup?
LLVM will do this if it can see the definition of `contains_key` (which it will, if it's generic) and can tell that it's pure. We don't have any way at the moment to force LLVM to decide that a function is pure if it can't work it out for itself, though.
Patrick _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev