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

2022-08-10 Thread Mandy Chung
On Tue, 9 Aug 2022 20:26:43 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()` is used in a n

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 contains 11 additional >> commi

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 contains 11 additional >> commit

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

2022-08-09 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(

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

2022-08-09 Thread Max Mielchen
On Sat, 6 Aug 2022 14:55:17 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()` is used in a n

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

2022-08-09 Thread Mandy Chung
On Sat, 6 Aug 2022 14:55:17 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()` is used in a n

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

2022-08-08 Thread Max Mielchen
On Sat, 6 Aug 2022 14:55:17 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()` is used in a n

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

2022-08-06 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(

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

2022-08-02 Thread Roger Riggs
On Tue, 2 Aug 2022 15:38:05 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()` is used in a n

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 formatted results? > If so, add this b

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

2022-08-02 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(

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

2022-08-02 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(

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

2022-08-02 Thread Roger Riggs
On Tue, 2 Aug 2022 13:58:52 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()` is used in a n

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/StackTraceElement.java line 365: > >> 363:

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

2022-08-02 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(

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

2022-08-02 Thread Quan Anh Mai
On Tue, 2 Aug 2022 13:34:26 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()` is used in a n

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` requires an array copy > anyway, you don

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

2022-08-02 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(

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

2022-08-01 Thread Quan Anh Mai
On Mon, 1 Aug 2022 17:35:05 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()` is used in a n

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

2022-08-01 Thread Сергей Цыпанов
On Mon, 1 Aug 2022 17:35:05 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()` is used in a n

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()) { >>> 365: prefixClassLoader = true; >>> 3

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

2022-08-01 Thread Quan Anh Mai
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()` is used in a numb

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

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(

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()

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 appendTo(Appendable dest) throws IOException { >> >> Perh

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

2022-08-01 Thread Сергей Цыпанов
On Thu, 28 Jul 2022 13:45:53 GMT, David Schlosnagle wrote: >> I think in this case it's better to specify `StringBuilder` instead of >> `Appendable`, because the method is private and you'd hardly ever pass there >> anything different from SB. > > If we go with the proposal above to make `appen

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

2022-08-01 Thread Сергей Цыпанов
On Thu, 28 Jul 2022 14:38:50 GMT, Carter Kozak wrote: >> `Throwable.printStackTrace()` will use `StringBuilder` as well, won't it? > > I don't think so, it appends directly do something like System.err (default) > or another PrintStream/PrintWriter without fully holding the string value on > he

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 Carter Kozak
On Thu, 28 Jul 2022 14:33:39 GMT, Сергей Цыпанов wrote: >> If we go with the proposal above to make `appendTo(Appendable)` package >> visible so that `Throwable.printStackTrace()` can benefit from this as well, >> we would need to keep this as Appendable, otherwise I agree we should just >> in

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 Carter Kozak
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()` is used in a numb

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

2022-08-01 Thread Сергей Цыпанов
On Thu, 28 Jul 2022 13:07:01 GMT, David Schlosnagle wrote: >> src/java.base/share/classes/java/lang/StackTraceElement.java line 400: >> >>> 398: dest.append(fileName) >>> 399: .append(':') >>> 400: .append(Integer.toString(lineNumbe

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

2022-08-01 Thread Сергей Цыпанов
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()` is used in a numb

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

2022-08-01 Thread Сергей Цыпанов
On Mon, 1 Aug 2022 16:20:25 GMT, David Schlosnagle wrote: >> If the objective of this patch is to optimise >> `StackTraceElement::toString()`, then I would suggest the most efficient >> method of calculating the length and encoding of the result, filling the >> backing buffer then using the pa

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

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