3 ms·
As for the section on Java, Java can indeed auto-vectorize certain loops, but the loops have to be "simple". Something like this would work: for (int i =
by stygiansonic 8y ago
As for the section on Java, Java can indeed auto-vectorize certain loops, but the loops have to be "simple". Something like this would work:
for (int i = 0; i < x.length; i++) {
z[i] = x[i] * y[i];
}
(Above code copied from: http://prestodb.rocks/code/simd/ http://prestodb.rocks/code/simd/ )
But the reason it doesn't work for the article's code is because of the accumulator variable. That is not supported yet. See: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=7192383 https://bugs.java.com/bugdatabase/view_bug.do?bug_id=7192383
However, the difference between using sum() and reduce() are interesting. Will eventually have to JMH to verify if this is still the case and if it matters in our codebase.