Integrated: 8330108: Increase CipherInputStream buffer size

2024-04-23 Thread Oli Gillespie
On Fri, 12 Apr 2024 15:34:01 GMT, Oli Gillespie wrote: > Increase buffer size in CipherInputStream from 512 bytes to 8192 bytes. > > I have seen applications where this small buffer size significantly reduces > throughput, and I've even seen applications which use reflection

Re: RFR: 8330108: Increase CipherInputStream buffer size

2024-04-23 Thread Oli Gillespie
On Fri, 12 Apr 2024 16:19:56 GMT, Sean Mullan wrote: > Please don't integrate until a Reviewer from the Security Group has reviewed > this. Thanks. @seanjmullan are you okay for me to integrate now? - PR Comment: https://git.openjdk.org/jdk/pull/18763#issuecomment-2071793073

Re: RFR: 8330108: Increase CipherInputStream buffer size

2024-04-19 Thread Oli Gillespie
On Fri, 12 Apr 2024 15:34:01 GMT, Oli Gillespie wrote: > Increase buffer size in CipherInputStream from 512 bytes to 8192 bytes. > > I have seen applications where this small buffer size significantly reduces > throughput, and I've even seen applications which use reflection

Re: RFR: 8330108: Increase CipherInputStream buffer size

2024-04-16 Thread Oli Gillespie
On Mon, 15 Apr 2024 19:34:18 GMT, Anthony Scarpino wrote: >> Can you provide memory usage difference between the current and your >> suggested change with `-prof gc`? With many of these situations, it's a >> balance between memory usage and performance. > >> @ascarpino here's the `-prof gc` r

Re: RFR: 8330108: Increase CipherInputStream buffer size

2024-04-15 Thread Oli Gillespie
On Fri, 12 Apr 2024 15:34:01 GMT, Oli Gillespie wrote: > Increase buffer size in CipherInputStream from 512 bytes to 8192 bytes. > > I have seen applications where this small buffer size significantly reduces > throughput, and I've even seen applications which use reflection

Re: RFR: 8330108: Increase CipherInputStream buffer size

2024-04-15 Thread Oli Gillespie
On Fri, 12 Apr 2024 16:49:49 GMT, Anthony Scarpino wrote: >> Increase buffer size in CipherInputStream from 512 bytes to 8192 bytes. >> >> I have seen applications where this small buffer size significantly reduces >> throughput, and I've even seen applications which use reflection to modify

RFR: 8330108: Increase CipherInputStream buffer size

2024-04-12 Thread Oli Gillespie
Increase buffer size in CipherInputStream from 512 bytes to 8192 bytes. I have seen applications where this small buffer size significantly reduces throughput, and I've even seen applications which use reflection to modify the buffer size to work around the issue. Using the existing `AESGCMCiph

Integrated: 8324646: Avoid Class.forName in SecureRandom constructor

2024-02-09 Thread Oli Gillespie
On Wed, 24 Jan 2024 15:25:28 GMT, Oli Gillespie wrote: > Avoid expensive `Class.forName` call when constructing Providers such as > `SecureRandom` which take constructor parameters. This can easily be cached > in EngineDescription (this cache already existed before, it was removed i

Integrated: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG

2024-02-09 Thread Oli Gillespie
On Wed, 24 Jan 2024 15:42:05 GMT, Oli Gillespie wrote: > A typical call to `new SecureRandom()` is slowed down by looking for a > constructor in NativePRNG which takes `java.security.SecureRandomParameters`. > NativePRNG does not have such a constructor, so the search fails >

Re: RFR: 8324646: Avoid Class.forName in SecureRandom constructor [v4]

2024-02-09 Thread Oli Gillespie
On Tue, 6 Feb 2024 13:52:09 GMT, Oli Gillespie wrote: >> Avoid expensive `Class.forName` call when constructing Providers such as >> `SecureRandom` which take constructor parameters. This can easily be cached >> in EngineDescription (this cache already existed before,

Re: RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG [v4]

2024-02-09 Thread Oli Gillespie
On Wed, 7 Feb 2024 09:49:10 GMT, Oli Gillespie wrote: >> A typical call to `new SecureRandom()` is slowed down by looking for a >> constructor in NativePRNG which takes >> `java.security.SecureRandomParameters`. NativePRNG does not have such a >> constructor, so th

Re: RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG [v3]

2024-02-07 Thread Oli Gillespie
On Tue, 6 Feb 2024 18:46:30 GMT, Valerie Peng wrote: >> Oli Gillespie has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Update copyright year > > src/java.base/unix/classes/sun/security/provider/Nativ

Re: RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG [v4]

2024-02-07 Thread Oli Gillespie
chmark from https://github.com/openjdk/jdk/pull/17559 shows around 80% > reduction in time taken to create a new SecureRandom with NativePRNG (default > on my machine). > > > Before > SecureRandomBench.newSecureRandom avgt 2930 ± 50 ns/op > > After > SecureRandomB

Re: RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG [v3]

2024-02-06 Thread Oli Gillespie
chmark from https://github.com/openjdk/jdk/pull/17559 shows around 80% > reduction in time taken to create a new SecureRandom with NativePRNG (default > on my machine). > > > Before > SecureRandomBench.newSecureRandom avgt 2930 ± 50 ns/op > > After > SecureRandomB

Re: RFR: 8324646: Avoid Class.forName in SecureRandom constructor [v4]

2024-02-06 Thread Oli Gillespie
kup - see > [JDK-8324648](https://bugs.openjdk.org/browse/JDK-8324648). > > > Before > newSecureRandom avgt 2930 ± 50 ns/op > > After > newSecureRandom avgt 2400 ± 33 ns/op > > > I have seen multiple real-world applications which call `new SecureRandom()` &

Re: RFR: 8324646: Avoid Class.forName in SecureRandom constructor [v3]

2024-02-06 Thread Oli Gillespie
On Thu, 1 Feb 2024 10:39:27 GMT, Oli Gillespie wrote: >> Avoid expensive `Class.forName` call when constructing Providers such as >> `SecureRandom` which take constructor parameters. This can easily be cached >> in EngineDescription (this cache already existed before,

Re: RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG

2024-02-06 Thread Oli Gillespie
On Wed, 24 Jan 2024 15:42:05 GMT, Oli Gillespie wrote: > A typical call to `new SecureRandom()` is slowed down by looking for a > constructor in NativePRNG which takes `java.security.SecureRandomParameters`. > NativePRNG does not have such a constructor, so the search fails >

Re: RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG [v2]

2024-02-06 Thread Oli Gillespie
chmark from https://github.com/openjdk/jdk/pull/17559 shows around 80% > reduction in time taken to create a new SecureRandom with NativePRNG (default > on my machine). > > > Before > SecureRandomBench.newSecureRandom avgt 2930 ± 50 ns/op > > After > SecureRandomB

Re: RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG

2024-02-01 Thread Oli Gillespie
On Wed, 24 Jan 2024 15:42:05 GMT, Oli Gillespie wrote: > A typical call to `new SecureRandom()` is slowed down by looking for a > constructor in NativePRNG which takes `java.security.SecureRandomParameters`. > NativePRNG does not have such a constructor, so the search fails >

Re: RFR: 8324646: Avoid Class.forName in SecureRandom constructor [v2]

2024-02-01 Thread Oli Gillespie
On Wed, 24 Jan 2024 18:05:50 GMT, Oli Gillespie wrote: >> Avoid expensive `Class.forName` call when constructing Providers such as >> `SecureRandom` which take constructor parameters. This can easily be cached >> in EngineDescription (this cache already existed before,

Re: RFR: 8324646: Avoid Class.forName in SecureRandom constructor [v3]

2024-02-01 Thread Oli Gillespie
kup - see > [JDK-8324648](https://bugs.openjdk.org/browse/JDK-8324648). > > > Before > newSecureRandom avgt 2930 ± 50 ns/op > > After > newSecureRandom avgt 2400 ± 33 ns/op > > > I have seen multiple real-world applications which call `new SecureRandom()` &

Re: RFR: 8324646: Avoid Class.forName in SecureRandom constructor [v2]

2024-01-31 Thread Oli Gillespie
On Wed, 24 Jan 2024 18:05:50 GMT, Oli Gillespie wrote: >> Avoid expensive `Class.forName` call when constructing Providers such as >> `SecureRandom` which take constructor parameters. This can easily be cached >> in EngineDescription (this cache already existed before,

Re: RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG

2024-01-31 Thread Oli Gillespie
On Wed, 24 Jan 2024 15:42:05 GMT, Oli Gillespie wrote: > A typical call to `new SecureRandom()` is slowed down by looking for a > constructor in NativePRNG which takes `java.security.SecureRandomParameters`. > NativePRNG does not have such a constructor, so the search fails >

Re: RFR: 8324646: Avoid Class.forName in SecureRandom constructor [v2]

2024-01-31 Thread Oli Gillespie
On Wed, 31 Jan 2024 17:23:42 GMT, Weijun Wang wrote: > How about just using class literals? There is no need to call > `Class.forName`, at least not now since they are all inside `java.base`. Thanks :). That seems sensible if writing from scratch, but that part I'm just reviving from [JDK-8280

Re: RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG

2024-01-25 Thread Oli Gillespie
On Wed, 24 Jan 2024 19:50:55 GMT, Chen Liang wrote: > I see that the existing caller code has a check for `ctorParamClass`. Why > must we declare `SecureRandomParameters.class` as the `ctorParamClass` for > these 3 randoms instead of using `null`? >From [lookup >code](https://github.com/openj

Re: RFR: 8324646: Avoid Class.forName in SecureRandom constructor [v2]

2024-01-25 Thread Oli Gillespie
On Wed, 24 Jan 2024 20:09:12 GMT, Roger Riggs wrote: >> I don't disagree in principle but it was like this before the revert, and is >> still like this in 17. > > Is volatile really needed? And there is some performance penalty and in > practice the value will be the same even if recomputed. S

Re: RFR: 8324646: Avoid Class.forName in SecureRandom constructor [v2]

2024-01-24 Thread Oli Gillespie
kup - see > [JDK-8324648](https://bugs.openjdk.org/browse/JDK-8324648). > > > Before > newSecureRandom avgt 2930 ± 50 ns/op > > After > newSecureRandom avgt 2400 ± 33 ns/op > > > I have seen multiple real-world applications which call `new SecureRandom()` &

Re: RFR: 8324646: Avoid Class.forName in SecureRandom constructor [v2]

2024-01-24 Thread Oli Gillespie
On Wed, 24 Jan 2024 17:45:06 GMT, Aleksey Shipilev wrote: >> Oli Gillespie has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Rename newSecureRandom -> create >> - Add copyright header to new file >

RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG

2024-01-24 Thread Oli Gillespie
A typical call to `new SecureRandom()` is slowed down by looking for a constructor in NativePRNG which takes `java.security.SecureRandomParameters`. NativePRNG does not have such a constructor, so the search fails [here](https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java

RFR: 8324646: Avoid Class.forName in SecureRandom constructor

2024-01-24 Thread Oli Gillespie
Avoid expensive `Class.forName` call when constructing Providers such as `SecureRandom` which take constructor parameters. This can easily be cached in EngineDescription (this cache already existed before, it was removed in [JDK-8280970](https://bugs.openjdk.org/browse/JDK-8280970) as unused, I'