Rust TOTD: rustc doesn't optimize this well: for i in x..y { buf[i] = z; } It does optimize this: for b in &mut buf[x..y] { *b = z; }
@jimblandy Surprising b/c:
1. buf is a fixed-sized array [u8; 64].
2. Even if it weren't fixed borrow checker ensures length doesn't change.
-
-
@brian_____@jimblandy Probably because of lack of alias information provided to LLVM at the moment. -
@pcwalton Interesting. Mightn't Rust be able to provide better alias information to LLVM than a C or C++ front end could?@BRIAN_____ -
@jimblandy@brian_____ Yeah, in time. Probably want MIR to land first
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.