RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v3]
Sergey Tsypanov
stsypanov at openjdk.org
Mon Apr 10 14:01:53 UTC 2023
> 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)
> .toFormatter();
> String text = dtf.format(LocalDateTime.now());
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 six additional commits since the last revision:
- Merge branch 'master' into dtfb
- 8300818: Add benchmark
- 8300818: Add benchmark
- Revert irrelevant change
- Merge branch 'master' into dtfb
- Improve padding of DateTimeFormatter
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/12131/files
- new: https://git.openjdk.org/jdk/pull/12131/files/322ae9b4..b40de5a8
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=12131&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=12131&range=01-02
Stats: 497235 lines in 5533 files changed: 277601 ins; 160858 del; 58776 mod
Patch: https://git.openjdk.org/jdk/pull/12131.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/12131/head:pull/12131
PR: https://git.openjdk.org/jdk/pull/12131
More information about the core-libs-dev
mailing list