News for hackers. Stuff that matters.
Re:Making the obvious code fast (2016) by stygiansonic on Wednesday April 17, 2019 @09:42AM (#19682437)
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/ )

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

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.

There are no comments on this comment yet.