Re: RFR: 8288667: Reduce runtime of java.text microbenchmarks

2022-06-18 Thread David Schlosnagle
On Fri, 17 Jun 2022 12:59:17 GMT, Claes Redestad wrote: > - Refactor micro using a range of parameters to a simpler benchmark that > tests different values in one pass > - Reduce iterations and their runtimes, but add forks (important to be able > to detect run-to-run variation anomalies) > >

Re: RFR: 8289643: File descriptor leak with ProcessBuilder.startPipeline [v2]

2022-07-08 Thread David Schlosnagle
On Fri, 8 Jul 2022 16:24:16 GMT, Roger Riggs wrote: >> The `ProcessBuilder.pipelineStart()` implementation does not close all of >> the file descriptors it uses to create the pipeline of processes. >> >> The process calling `pipelineStart()` is creating the pipes between the >> stages. >> As e

RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread David Schlosnagle
I would like to contribute an optimized version of `StackTraceElement#toString()` that uses a single StringBuilder throughout creation to avoid intermediate `String` allocations. `StackTraceElement#toString()` is used in a number of JDK code paths including `Throwable#printStackTrace()`, as wel

Re: RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread David Schlosnagle
On Thu, 28 Jul 2022 15:42:15 GMT, Quan Anh Mai wrote: >> I would like to contribute an optimized version of >> `StackTraceElement#toString()` that uses a single StringBuilder throughout >> creation to avoid intermediate `String` allocations. >> `StackTraceElement#toString()` is used in a numbe

Re: RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread David Schlosnagle
On Thu, 28 Jul 2022 13:12:57 GMT, Сергей Цыпанов wrote: >> `Appendable` does not currently have an `append(int)` method on the >> interface, though `StringBuilder` does. We could add it to `Appendable` via >> default method if so desired: >> >> >> default Appendable append(int value) { >>

Re: RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread David Schlosnagle
On Mon, 1 Aug 2022 17:08:12 GMT, Сергей Цыпанов wrote: >> I would like to contribute an optimized version of >> `StackTraceElement#toString()` that uses a single StringBuilder throughout >> creation to avoid intermediate `String` allocations. >> `StackTraceElement#toString()` is used in a numb

Re: RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread David Schlosnagle
On Thu, 28 Jul 2022 01:23:53 GMT, David Schlosnagle wrote: >> src/java.base/share/classes/java/lang/StackTraceElement.java line 374: >> >>> 372: * @throws IOException If an I/O error occurs >>> 373: */ >>> 374: private void appen

Re: RFR: 8291641: Optimize StackTraceElement.toString()

2022-08-01 Thread David Schlosnagle
On Thu, 28 Jul 2022 00:48:32 GMT, Carter Kozak wrote: >> I would like to contribute an optimized version of >> `StackTraceElement#toString()` that uses a single StringBuilder throughout >> creation to avoid intermediate `String` allocations. >> `StackTraceElement#toString()` is used in a numbe

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v2]

2022-08-01 Thread David Schlosnagle
String avgt 15 132.781 ±2.095 > ns/op > > > After > > Benchmark Mode Cnt Score Error > Units > StackTraceElementBench.printStackTrace avgt 15 142909.133 ± 2290.720 > ns/op > StackTraceElementBench.toStri

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v2]

2022-08-01 Thread David Schlosnagle
On Mon, 1 Aug 2022 17:24:48 GMT, David Schlosnagle wrote: >> src/java.base/share/classes/java/lang/StackTraceElement.java line 366: >> >>> 364: if (!dropClassLoaderName() && classLoaderName != null && >>> !classLoaderName.isEmpty()) {

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v3]

2022-08-02 Thread David Schlosnagle
String avgt 15 132.781 ±2.095 > ns/op > > > After > > Benchmark Mode Cnt Score Error > Units > StackTraceElementBench.printStackTrace avgt 15 142909.133 ± 2290.720 > ns/op > StackTraceElementBench.toStri

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v2]

2022-08-02 Thread David Schlosnagle
On Tue, 2 Aug 2022 05:29:38 GMT, Quan Anh Mai wrote: >> David Schlosnagle has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Address comments > > Since constructing a `String` from a `StringBuilder` require

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v4]

2022-08-02 Thread David Schlosnagle
String avgt 15 132.781 ±2.095 > ns/op > > > After > > Benchmark Mode Cnt Score Error > Units > StackTraceElementBench.printStackTrace avgt 15 142909.133 ± 2290.720 > ns/op > StackTraceElementBench.toStri

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v3]

2022-08-02 Thread David Schlosnagle
On Tue, 2 Aug 2022 13:52:30 GMT, Quan Anh Mai wrote: >> David Schlosnagle has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Estimate length > > src/java.base/share/classes/java/lang/StackTraceEl

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v5]

2022-08-02 Thread David Schlosnagle
String avgt 15 132.781 ±2.095 > ns/op > > > After > > Benchmark Mode Cnt Score Error > Units > StackTraceElementBench.printStackTrace avgt 15 142909.133 ± 2290.720 > ns/op > StackTraceElementBench.toStri

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v6]

2022-08-02 Thread David Schlosnagle
String avgt 15 132.781 ±2.095 > ns/op > > > After > > Benchmark Mode Cnt Score Error > Units > StackTraceElementBench.printStackTrace avgt 15 142909.133 ± 2290.720 > ns/op > StackTraceElementBench.toStri

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v4]

2022-08-02 Thread David Schlosnagle
On Tue, 2 Aug 2022 14:13:25 GMT, Roger Riggs wrote: >> David Schlosnagle has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Inline max Integer.stringSize > > Are there existing tests that validate the formatt

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v7]

2022-08-06 Thread David Schlosnagle
String avgt 15 132.781 ±2.095 > ns/op > > > After > > Benchmark Mode Cnt Score Error > Units > StackTraceElementBench.printStackTrace avgt 15 142909.133 ± 2290.720 > ns/op > StackTraceElementBench.toStri

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v8]

2022-08-09 Thread David Schlosnagle
String avgt 15 132.781 ±2.095 > ns/op > > > After > > Benchmark Mode Cnt Score Error > Units > StackTraceElementBench.printStackTrace avgt 15 142909.133 ± 2290.720 > ns/op > StackTraceElementBench.toStri

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v7]

2022-08-09 Thread David Schlosnagle
On Tue, 9 Aug 2022 18:35:05 GMT, Mandy Chung wrote: >> David Schlosnagle has updated the pull request with a new target base due to >> a merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request cont

Re: RFR: 8291641: Optimize StackTraceElement.toString() [v7]

2022-08-09 Thread David Schlosnagle
On Mon, 8 Aug 2022 18:55:39 GMT, Max Mielchen wrote: >> David Schlosnagle has updated the pull request with a new target base due to >> a merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request cont

Integrated: 8291641: Optimize StackTraceElement.toString()

2022-08-10 Thread David Schlosnagle
On Wed, 27 Jul 2022 22:56:39 GMT, David Schlosnagle wrote: > I would like to contribute an optimized version of > `StackTraceElement#toString()` that uses a single StringBuilder throughout > creation to avoid intermediate `String` allocations. > `StackTraceElement#toString()`

Re: RFR: 8290313: Produce warning when user specified java.io.tmpdir directory doesn't exist

2022-09-07 Thread David Schlosnagle
On Tue, 23 Aug 2022 18:32:30 GMT, Weibing Xiao wrote: > 8290313: Produce warning when user specified java.io.tmpdir directory doesn't > exist src/java.base/share/classes/java/io/File.java line 2180: > 2178: > 2179: > 2180: if(!tmpdir.exists() || !tmpdir.canWrite()) { Should this che

Re: RFR: JDK-8285932 Implementation of JEP-430 String Templates (Preview) [v3]

2022-10-31 Thread David Schlosnagle
On Fri, 28 Oct 2022 20:04:18 GMT, Rémi Forax wrote: >> But it's an implementation details, BTW i wonder if the limitation is still >> valid, i know that John has changed the implementation of the BSM in that >> area. > > Anyway, i think you are right, this can be public If this is a public int

Re: RFR: JDK-8285932 Implementation of JEP-430 String Templates (Preview) [v7]

2022-10-31 Thread David Schlosnagle
On Mon, 31 Oct 2022 20:11:34 GMT, Jim Laskey wrote: >> Enhance the Java programming language with string templates, which are >> similar to string literals but contain embedded expressions. A string >> template is interpreted at run time by replacing each expression with the >> result of evalu

Re: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v9]

2022-11-08 Thread David Schlosnagle
On Tue, 8 Nov 2022 23:48:22 GMT, Claes Redestad wrote: >> Continuing the work initiated by @luhenry to unroll and then intrinsify >> polynomial hash loops. >> >> I've rewired the library changes to route via a single `@IntrinsicCandidate` >> method. To make this work I've harmonized how they a

Re: RFR: 8301958: Reduce Arrays.copyOf/-Range overheads [v7]

2023-02-07 Thread David Schlosnagle
On Wed, 8 Feb 2023 00:07:14 GMT, Claes Redestad wrote: >> This patch adds special-cases to `Arrays.copyOf` and `Arrays.copyOfRange` to >> clone arrays when `newLength` or range inputs span the input array. This >> helps eliminate range checks and has been verified to help various String >> ope

Re: RFR: 8301958: Reduce Arrays.copyOf/-Range overheads [v7]

2023-02-07 Thread David Schlosnagle
On Wed, 8 Feb 2023 00:07:14 GMT, Claes Redestad wrote: >> This patch adds special-cases to `Arrays.copyOf` and `Arrays.copyOfRange` to >> clone arrays when `newLength` or range inputs span the input array. This >> helps eliminate range checks and has been verified to help various String >> ope

Re: RFR: 8301958: Reduce Arrays.copyOf/-Range overheads [v9]

2023-02-08 Thread David Schlosnagle
On Wed, 8 Feb 2023 10:53:22 GMT, Claes Redestad wrote: >> This patch adds special-cases to `Arrays.copyOf` and `Arrays.copyOfRange` to >> clone arrays when `newLength` or range inputs span the input array. This >> helps eliminate range checks and has been verified to help various String >> ope

Re: RFR: 8302315: Examine cost of clone of primitive arrays compared to arraycopy

2023-02-17 Thread David Schlosnagle
On Fri, 17 Feb 2023 09:58:54 GMT, Claes Redestad wrote: > During work on #12453 @schlosna reported that `array.clone()` might > underperform `System.arraycopy` in microbenchmarks and I opted to go with > `arraycopy` throughout while investigating. > > Testing on x86 (SandyBridge, AVX2) I obser

Re: RFR: 8302863: Speed up String::encodeASCII using countPositives

2023-02-20 Thread David Schlosnagle
On Sat, 18 Feb 2023 23:26:08 GMT, Claes Redestad wrote: > When encoding Strings to US-ASCII we can speed up the happy path > significantly by using `StringCoding.countPositives` as a speculative check > for whether there are any chars that needs to be replaced by `'?'`. Once a > non-ASCII char

Re: RFR: 8302871: Speed up StringLatin1.regionMatchesCI

2023-02-20 Thread David Schlosnagle
On Sat, 18 Feb 2023 09:21:25 GMT, Eirik Bjorsnos wrote: > This PR suggests we can speed up `StringLatin1.regionMatchesCI` by applying > 'the oldest ASCII trick in the book'. > > The new static method `CharacterDataLatin1.equalsIgnoreCase` compares two > latin1 bytes for equality ignoring case.

Re: RFR: 8302871: Speed up StringLatin1.regionMatchesCI

2023-02-20 Thread David Schlosnagle
On Sat, 18 Feb 2023 19:45:34 GMT, Eirik Bjorsnos wrote: >> src/java.base/share/classes/java/lang/CharacterDataLatin1.java.template line >> 181: >> >>> 179: return ( U <= 'Z' // In range A-Z >>> 180: || (U >= 0xC0 && U <= 0XDE && U != 0xD7)) // ..or >>> A-grave-Thorn,

Re: RFR: 8304836: Make MALLOC_MIN4 macro more robust

2023-04-21 Thread David Schlosnagle
On Thu, 20 Apr 2023 18:39:29 GMT, Naoto Sato wrote: > The current macro assumes the argument is `jint` because all locations pass > `jint`. However, this would not work if a wider type such as `jlong` is > passed. Removing the `unsigned` cast and make the condition explicit would > make the ma

Re: RFR: 8308804: Improve UUID.randomUUID performance with bulk/scalable PRNG access [v7]

2023-09-04 Thread David Schlosnagle
On Thu, 1 Jun 2023 09:37:29 GMT, Aleksey Shipilev wrote: >> UUID is the very important class that is used to track identities of objects >> in large scale systems. On some of our systems, `UUID.randomUUID` takes >1% >> of total CPU time, and is frequently a scalability bottleneck due to >> `Se

Re: RFR: 8317980: Optimization for Integer.parseInt and Long.parseLong

2023-10-11 Thread David Schlosnagle
On Tue, 10 Oct 2023 02:54:05 GMT, Shaojin Wen wrote: > By extracting the code that creates the exception, the CodeSize of these > methods is less than the default FreqInlineSize 325. and for the scenario > where the most commonly used radix is not specified and the String coder is > LATIN1, f

Re: RFR: 8317980: Optimization for Integer.parseInt and Long.parseLong

2023-10-11 Thread David Schlosnagle
On Thu, 12 Oct 2023 00:14:45 GMT, Chen Liang wrote: >> Code style should be consistent > > He means to pull the `radix< Character,MIN_RADIX` and `radix > > Character.MAX_RADIX` shared code in Integer and Long.parseInt (with radix > version) to a helper method. More explicitly I was thinking so

Re: RFR: 8335366: Improve String.format performance with fastpath

2024-06-29 Thread David Schlosnagle
On Sat, 29 Jun 2024 11:53:31 GMT, Shaojin Wen wrote: > We need a String format solution with good performance. String Template was > once expected, but it has been removed. j.u.Formatter is powerful, but its > performance is not good enough. > > This PR implements a subset of j.u.Formatter cap

Re: RFR: 8335366: Improve String.format performance with fastpath [v3]

2024-06-29 Thread David Schlosnagle
On Sat, 29 Jun 2024 16:16:51 GMT, David Schlosnagle wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> rename `digit` to `width` > > src/java.base/share/classes/java/lang/Strin

Re: RFR: 8335366: Improve String.format performance with fastpath [v5]

2024-06-29 Thread David Schlosnagle
On Sat, 29 Jun 2024 18:59:33 GMT, Shaojin Wen wrote: >> We need a String format solution with good performance. String Template was >> once expected, but it has been removed. j.u.Formatter is powerful, but its >> performance is not good enough. >> >> This PR implements a subset of j.u.Formatte

Re: RFR: 8335366: Improve String.format performance with fastpath [v7]

2024-06-30 Thread David Schlosnagle
On Sun, 30 Jun 2024 14:57:26 GMT, David Schlosnagle wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> laze init for `decimal fast path locale` > > src/java.base/share/classes/java/l

Re: RFR: 8335366: Improve String.format performance with fastpath [v7]

2024-06-30 Thread David Schlosnagle
On Sun, 30 Jun 2024 04:54:35 GMT, Shaojin Wen wrote: >> We need a String format solution with good performance. String Template was >> once expected, but it has been removed. j.u.Formatter is powerful, but its >> performance is not good enough. >> >> This PR implements a subset of j.u.Formatte

Re: RFR: 8335366: Improve String.format performance with fastpath [v5]

2024-07-01 Thread David Schlosnagle
On Mon, 1 Jul 2024 16:28:09 GMT, ExE Boss wrote: >> j.u.Formatter supports args == null > > When `args == null` or `args.length == 0`, then the format string can still > contain `%%` or `%n`, and those will be formatted to `"%"` and  > [`System​.lineSeparator()`] respectively. > > [`System​.lin