RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v2]
Patrick Doyle
duke at openjdk.java.net
Tue Mar 8 19:37:06 UTC 2022
On Mon, 7 Mar 2022 21:41:05 GMT, Richard Startin <duke at 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
More information about the core-libs-dev
mailing list