Making the obvious code fast (2016)
It is also possible to use rust intrinsics to get the same speed as the AVX2 vectorized C code here, but to use those you have to write out the loop explicitly:
It would be nice if the rustc compiler had an option to just apply this globally, so you could use the higher order functions. Finally, when we get down to a basic imperative for loop, javascript performs comparably to SEE vectorized C.
Java 8 includes a very nice library called stream which provides higher order functions over collections in a lazy evaluated manner, similar to the F# Nessos streams library and Rust. If we tweak the java code to do normal summation the runtime remains as fast as SSE vectorized C, a nice accomplishment:
There does not appear to be a way to get SIMD out of Java, either explicitly or via automatic vectorization by the Hotspot JVM.
Source: jackmott.github.io