Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-04-19 Thread Sergey Tsypanov
On Mon, 17 Apr 2023 15:21:34 GMT, Roger Riggs wrote: >> @RogerRiggs sorry I don't get it. Maybe you mean speacial casing for >> `padWidth - len`? > > Yes, I meant on the length of the inserted padding. Done - PR Review Comment:

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-04-17 Thread Roger Riggs
On Sun, 16 Apr 2023 11:44:52 GMT, Sergey Tsypanov wrote: >> Special casing for len == 0 and keeping the existing buf.insert for len == 1 >> would avoid object creation except when it would improve performance. > > @RogerRiggs sorry I don't get it. Maybe you mean speacial casing for > `padWidth

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-04-16 Thread Sergey Tsypanov
On Wed, 12 Apr 2023 17:41:58 GMT, Roger Riggs wrote: >> Added benchmark for this > > Special casing for len == 0 and keeping the existing buf.insert for len == 1 > would avoid object creation except when it would improve performance. @RogerRiggs sorry I don't get it. Maybe you mean speacial

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-04-12 Thread Roger Riggs
On Fri, 24 Mar 2023 19:28:57 GMT, Sergey Tsypanov wrote: >> Meant that you should verify that something like this, which just add a >> little padding, doesn't regress with your changes: >> >> DateTimeFormatter dtf = new DateTimeFormatterBuilder() >> .appendLiteral("Year:") >>

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-04-10 Thread Sergey Tsypanov
On Mon, 13 Mar 2023 19:24:38 GMT, Roger Riggs wrote: >> Sergey Tsypanov 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 two additional >>

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-03-24 Thread Roger Riggs
On Sun, 22 Jan 2023 09:50:21 GMT, Sergey Tsypanov wrote: >> Currently it's O(n) - we do `n` shifts of bytes within `StringBuilder`. This >> can be reduced to O(1) improving the code like: >> >> DateTimeFormatter dtf = new DateTimeFormatterBuilder() >> .appendLiteral("Date:") >>

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-03-24 Thread Sergey Tsypanov
On Sun, 22 Jan 2023 09:50:21 GMT, Sergey Tsypanov wrote: >> Currently it's O(n) - we do `n` shifts of bytes within `StringBuilder`. This >> can be reduced to O(1) improving the code like: >> >> DateTimeFormatter dtf = new DateTimeFormatterBuilder() >> .appendLiteral("Date:") >>

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-03-24 Thread Sergey Tsypanov
On Mon, 23 Jan 2023 11:34:27 GMT, Claes Redestad wrote: >> The modified code is called only when a user explicitly calls `padNext(int, >> char)`, i.e. if I modified the example snippet as >> >> DateTimeFormatter dtf = new DateTimeFormatterBuilder() >> .appendLiteral("Date:") >>

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-03-24 Thread Sergey Tsypanov
On Mon, 13 Mar 2023 19:24:38 GMT, Roger Riggs wrote: >> Sergey Tsypanov 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 two additional >>

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-01-23 Thread Claes Redestad
On Sun, 22 Jan 2023 13:28:06 GMT, Sergey Tsypanov wrote: >> src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java >> line 2611: >> >>> 2609: "Cannot print as output of " + len + " characters >>> exceeds pad width of " + padWidth); >>> 2610:

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-01-22 Thread Sergey Tsypanov
On Sun, 22 Jan 2023 11:36:34 GMT, Claes Redestad wrote: >> Sergey Tsypanov 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 two additional >>

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-01-22 Thread Sergey Tsypanov
On Sun, 22 Jan 2023 10:56:11 GMT, Claes Redestad wrote: >> Sergey Tsypanov 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 two additional >>

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-01-22 Thread Claes Redestad
On Sun, 22 Jan 2023 09:50:21 GMT, Sergey Tsypanov wrote: >> Currently it's O(n) - we do `n` shifts of bytes within `StringBuilder`. This >> can be reduced to O(1) improving the code like: >> >> DateTimeFormatter dtf = new DateTimeFormatterBuilder() >> .appendLiteral("Date:") >>

Re: RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v2]

2023-01-22 Thread Sergey Tsypanov
> Currently it's O(n) - we do `n` shifts of bytes within `StringBuilder`. This > can be reduced to O(1) improving the code like: > > DateTimeFormatter dtf = new DateTimeFormatterBuilder() > .appendLiteral("Date:") > .padNext(20, ' ') > .append(DateTimeFormatter.ISO_DATE) >