So I noticed this while profiling my path tracer. My dot-product was using sum internally and I was getting ~14 FPS - and with a normal loop, I was getting ~23 FPS.
This playground link shows the same issue (for me anyway): http://play.rust-lang.org/?gist=564c477ac1347b452ebd2ae784094875&version=stable&mode=release&edition=2015
This is in release mode too. I’d expect it to optimize down to roughly the same thing. Is there anything I can do to encourage that optimization? Or should I just… write my own loop?