<i18n dev> RFR: 8300818: Reduce complexity of padding with DateTimeFormatter [v7]
Sergey Tsypanov
stsypanov at openjdk.org
Fri Apr 21 17:45:50 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 incrementally with one additional commit since the last revision:
8300818: One more benchmark
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/12131/files
- new: https://git.openjdk.org/jdk/pull/12131/files/baa7f92e..48a0cc70
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=12131&range=06
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=12131&range=05-06
Stats: 14 lines in 1 file changed: 11 ins; 0 del; 3 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 i18n-dev
mailing list