On Mon, 7 Mar 2022 21:41:05 GMT, Richard Startin <d...@openjdk.java.net> wrote:
>> Ludovic Henry has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add UTF-16 benchmarks > > Great to see this taken up. As it’s implemented here, it’s still scalar, but > the unroll prevents a strength reduction of the multiplication in the loop > from > > result = 31 * result + element; > > to: > > result = (result << 5) - result + element > > which creates a data dependency and slows the loop down. > > This was first reported by Peter Levart here: > http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-September/028898.html @richardstartin - does that strength reduction actually happen? The bit-shift transformation valid only if the original `result` is known to be non-negative. ------------- PR: https://git.openjdk.java.net/jdk/pull/7700