Re: RFR: 8333867: SHA3 performance can be improved [v4]

2024-06-18 Thread Ferenc Rakoczi
> This PR removes some unnecessary conversions between byte arrays and long > arrays during SHA3 digest computations. Ferenc Rakoczi has updated the pull request incrementally with one additional commit since the last revision: Copyright year update. - Changes: - all: https://

Re: RFR: 8333867: SHA3 performance can be improved [v3]

2024-06-14 Thread Valerie Peng
On Fri, 14 Jun 2024 10:39:45 GMT, Ferenc Rakoczi wrote: >> This PR removes some unnecessary conversions between byte arrays and long >> arrays during SHA3 digest computations. > > Ferenc Rakoczi has updated the pull request incrementally with one additional > commit since the last revision: >

Re: RFR: 8333867: SHA3 performance can be improved [v3]

2024-06-14 Thread Valerie Peng
On Fri, 14 Jun 2024 10:39:45 GMT, Ferenc Rakoczi wrote: >> This PR removes some unnecessary conversions between byte arrays and long >> arrays during SHA3 digest computations. > > Ferenc Rakoczi has updated the pull request incrementally with one additional > commit since the last revision: >

Re: RFR: 8333867: SHA3 performance can be improved [v2]

2024-06-14 Thread Valerie Peng
On Fri, 14 Jun 2024 09:47:31 GMT, Ferenc Rakoczi wrote: >> src/java.base/share/classes/sun/security/provider/SHA3.java line 73: >> >>> 71: // The following array is allocated to size WIDTH bytes, but we only >>> 72: // ever use the first blockSize bytes it (for bytes <-> long >>> conver

Re: RFR: 8333867: SHA3 performance can be improved [v3]

2024-06-14 Thread Ferenc Rakoczi
> This PR removes some unnecessary conversions between byte arrays and long > arrays during SHA3 digest computations. Ferenc Rakoczi has updated the pull request incrementally with one additional commit since the last revision: Accept more review suggestions - Changes: - all:

Re: RFR: 8333867: SHA3 performance can be improved [v2]

2024-06-14 Thread Ferenc Rakoczi
On Fri, 14 Jun 2024 05:56:05 GMT, Andrey Turbanov wrote: >> Ferenc Rakoczi has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix clone(), accept review suggestions. > > src/java.base/share/classes/sun/security/provider/SHA3.java line 152:

Re: RFR: 8333867: SHA3 performance can be improved [v2]

2024-06-14 Thread Ferenc Rakoczi
On Thu, 13 Jun 2024 20:25:22 GMT, Valerie Peng wrote: >> Ferenc Rakoczi has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix clone(), accept review suggestions. > > src/java.base/share/classes/sun/security/provider/SHA3.java line 73: > >

Re: RFR: 8333867: SHA3 performance can be improved [v2]

2024-06-13 Thread Andrey Turbanov
On Wed, 12 Jun 2024 14:08:43 GMT, Ferenc Rakoczi wrote: >> This PR removes some unnecessary conversions between byte arrays and long >> arrays during SHA3 digest computations. > > Ferenc Rakoczi has updated the pull request incrementally with one additional > commit since the last revision: >

Re: RFR: 8333867: SHA3 performance can be improved [v2]

2024-06-13 Thread Valerie Peng
On Wed, 12 Jun 2024 14:08:43 GMT, Ferenc Rakoczi wrote: >> This PR removes some unnecessary conversions between byte arrays and long >> arrays during SHA3 digest computations. > > Ferenc Rakoczi has updated the pull request incrementally with one additional > commit since the last revision: >

Re: RFR: 8333867: SHA3 performance can be improved [v2]

2024-06-12 Thread Vladimir Kozlov
On Wed, 12 Jun 2024 20:04:40 GMT, Ferenc Rakoczi wrote: > tier1,2,3 mach5 tests all passed. Thank you for testing. - PR Comment: https://git.openjdk.org/jdk/pull/19632#issuecomment-2163863932

Re: RFR: 8333867: SHA3 performance can be improved [v2]

2024-06-12 Thread Vladimir Kozlov
On Wed, 12 Jun 2024 14:08:43 GMT, Ferenc Rakoczi wrote: >> This PR removes some unnecessary conversions between byte arrays and long >> arrays during SHA3 digest computations. > > Ferenc Rakoczi has updated the pull request incrementally with one additional > commit since the last revision: >

Re: RFR: 8333867: SHA3 performance can be improved [v2]

2024-06-12 Thread Ferenc Rakoczi
On Wed, 12 Jun 2024 14:08:43 GMT, Ferenc Rakoczi wrote: >> This PR removes some unnecessary conversions between byte arrays and long >> arrays during SHA3 digest computations. > > Ferenc Rakoczi has updated the pull request incrementally with one additional > commit since the last revision: >

Re: RFR: 8333867: SHA3 performance can be improved [v2]

2024-06-12 Thread Ferenc Rakoczi
On Tue, 11 Jun 2024 18:21:49 GMT, Daniel Jeliński wrote: >> okay > > Could you try using MethodHandles instead of b2lLittle? Similar to what's > used in ChaCha20: > https://github.com/openjdk/jdk/blob/b77bd5fd6a6f7ddbed90300fba790da4fb683275/src/java.base/share/classes/com/sun/crypto/provider/Ch

Re: RFR: 8333867: SHA3 performance can be improved [v2]

2024-06-12 Thread Ferenc Rakoczi
> This PR removes some unnecessary conversions between byte arrays and long > arrays during SHA3 digest computations. Ferenc Rakoczi has updated the pull request incrementally with one additional commit since the last revision: Fix clone(), accept review suggestions. - Changes:

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-11 Thread Ferenc Rakoczi
On Tue, 11 Jun 2024 18:18:41 GMT, Daniel Jeliński wrote: >> This PR removes some unnecessary conversions between byte arrays and long >> arrays during SHA3 digest computations. > > src/java.base/share/classes/sun/security/provider/SHA3.java line 70: > >> 68: private long[] state = new long[

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-11 Thread Daniel Jeliński
On Mon, 10 Jun 2024 15:01:55 GMT, Ferenc Rakoczi wrote: > This PR removes some unnecessary conversions between byte arrays and long > arrays during SHA3 digest computations. src/java.base/share/classes/sun/security/provider/SHA3.java line 70: > 68: private long[] state = new long[DM*DM]; >

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-11 Thread Daniel Jeliński
On Tue, 11 Jun 2024 17:39:29 GMT, Vladimir Kozlov wrote: >> There is no other use.. That array is there for the sole purpose of holding >> the input as a long array before it gets xor-ed into the state. > > okay Could you try using MethodHandles instead of b2lLittle? Similar to what's used in

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-11 Thread Vladimir Kozlov
On Tue, 11 Jun 2024 09:55:11 GMT, Ferenc Rakoczi wrote: >> This PR removes some unnecessary conversions between byte arrays and long >> arrays during SHA3 digest computations. > > Some microbenchmark data (the percentages are improvements in ops/sec): > Benchmark

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-11 Thread Vladimir Kozlov
On Tue, 11 Jun 2024 17:30:37 GMT, Ferenc Rakoczi wrote: >> Thank you for explanation. >> >> An other question. Is any other use of `longBuf` array after >> `implCompress0()` call which load values from it? Because Intrinsic code >> will not update it. > > There is no other use.. That array is

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-11 Thread Ferenc Rakoczi
On Tue, 11 Jun 2024 15:53:33 GMT, Vladimir Kozlov wrote: >> Oh, and about the length: buffer is allocated in the constructor of the >> parent class (DigestBase) like this: >> buffer = new byte[blockSize]; >> Here blockSize is one of { 72, 104, 136, 144, 168 }, so divisible by 8. >> buffer.leng

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-11 Thread Vladimir Kozlov
On Tue, 11 Jun 2024 08:03:48 GMT, Ferenc Rakoczi wrote: >> Well, the intrinsic function treats the input and state as long arrays >> anyways, and so it only works on little endian architectures, where the >> conversion is a no-op. There is no additional array copy, this b2lLittle() >> call use

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-11 Thread Ferenc Rakoczi
On Mon, 10 Jun 2024 15:01:55 GMT, Ferenc Rakoczi wrote: > This PR removes some unnecessary conversions between byte arrays and long > arrays during SHA3 digest computations. Some microbenchmark data (the percentages are improvements in ops/sec): Benchmark

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-11 Thread Ferenc Rakoczi
On Mon, 10 Jun 2024 21:09:16 GMT, Ferenc Rakoczi wrote: >> src/java.base/share/classes/sun/security/provider/SHA3.java line 100: >> >>> 98: b2lLittle(b, ofs, longBuf, 0, blockSize); >>> 99: for (int i = 0; i < blockSize / 8; i++) { >>> 100: state[i] ^= longBuf[i]; >>

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-10 Thread Ferenc Rakoczi
On Mon, 10 Jun 2024 18:43:49 GMT, Vladimir Kozlov wrote: >> This PR removes some unnecessary conversions between byte arrays and long >> arrays during SHA3 digest computations. > > src/java.base/share/classes/sun/security/provider/SHA3.java line 100: > >> 98: b2lLittle(b, ofs, longBuf,

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-10 Thread Vladimir Kozlov
On Mon, 10 Jun 2024 15:01:55 GMT, Ferenc Rakoczi wrote: > This PR removes some unnecessary conversions between byte arrays and long > arrays during SHA3 digest computations. src/java.base/share/classes/sun/security/provider/SHA3.java line 100: > 98: b2lLittle(b, ofs, longBuf, 0, blockS

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-10 Thread Vladimir Kozlov
On Mon, 10 Jun 2024 17:29:31 GMT, Ferenc Rakoczi wrote: >> src/java.base/share/classes/sun/security/provider/SHA3.java line 98: >> >>> 96: @IntrinsicCandidate >>> 97: private void implCompress0(byte[] b, int ofs) { >>> 98: b2lLittle(b, ofs, longBuf, 0, blockSize); >> >> What abo

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-10 Thread Ferenc Rakoczi
On Mon, 10 Jun 2024 17:25:21 GMT, Vladimir Kozlov wrote: >> This PR removes some unnecessary conversions between byte arrays and long >> arrays during SHA3 digest computations. > > src/java.base/share/classes/sun/security/provider/SHA3.java line 98: > >> 96: @IntrinsicCandidate >> 97: p

Re: RFR: 8333867: SHA3 performance can be improved

2024-06-10 Thread Vladimir Kozlov
On Mon, 10 Jun 2024 15:01:55 GMT, Ferenc Rakoczi wrote: > This PR removes some unnecessary conversions between byte arrays and long > arrays during SHA3 digest computations. src/java.base/share/classes/sun/security/provider/SHA3.java line 98: > 96: @IntrinsicCandidate > 97: private voi

RFR: 8333867: SHA3 performance can be improved

2024-06-10 Thread Ferenc Rakoczi
This PR removes some unnecessary conversions between byte arrays and long arrays during SHA3 digest computations. - Commit messages: - 8333867: SHA3 performance can be improved Changes: https://git.openjdk.org/jdk/pull/19632/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=