Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> Big

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> Big

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers

2023-10-16 Thread Shaojin Wen
On Sun, 17 Sep 2023 16:01:33 GMT, Shaojin Wen wrote: > @cl4es made performance optimizations for the simple specifiers of > String.format in PR https://github.com/openjdk/jdk/pull/2830. Based on the > same idea, I continued to make improvements. I made patterns like %2d %02

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers

2023-10-16 Thread Shaojin Wen
On Mon, 25 Sep 2023 11:46:36 GMT, Claes Redestad wrote: > > The reason why I split it into multiple small methods is to avoid a single > > method codeSize > 325. After merging small methods, the performance will > > decrease. > > Yes, I can refactor to keep the same structure and verify

RFR: 8316150: Refactor get chars and string size

2023-10-16 Thread Shaojin Wen
1. Reduce duplicate stringSize code 2. Move java.lang.StringLatin1.getChars to jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other packages also need to use this method - Commit messages: - Revert FormatItem related changes - restore

RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers

2023-10-16 Thread Shaojin Wen
@cl4es made performance optimizations for the simple specifiers of String.format in PR https://github.com/openjdk/jdk/pull/2830. Based on the same idea, I continued to make improvements. I made patterns like %2d %02d also be optimized. The following are the test results based on MacBookPro M1

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-16 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> Big

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-16 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: Use StringConcatFactory.makeConcatWithConstants - Changes: - all: https://git.openjdk.org/jdk/pull/16006/fi

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v13]

2023-10-16 Thread Shaojin Wen
On Thu, 28 Sep 2023 15:01:25 GMT, Raffaello Giulietti wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Refactor according to rgiulietti's suggestion and add testcases > > Meaningful

Re: RFR: 8316150: Refactor get chars and string size

2023-10-16 Thread Shaojin Wen
On Fri, 22 Sep 2023 11:53:18 GMT, Andriy Plokhotnyuk wrote: >> 1. Reduce duplicate stringSize code >> 2. Move java.lang.StringLatin1.getChars to >> jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other >> packages also need to use this method > >

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers

2023-10-16 Thread Shaojin Wen
On Mon, 25 Sep 2023 12:28:06 GMT, Claes Redestad wrote: >> @cl4es made performance optimizations for the simple specifiers of >> String.format in PR https://github.com/openjdk/jdk/pull/2830. Based on the >> same idea, I continued to make improvements. I made patterns like %2d %02d >> also be

Re: RFR: 8316150: Refactor get chars and string size

2023-10-16 Thread Shaojin Wen
On Tue, 19 Sep 2023 16:15:12 GMT, Roger Riggs wrote: > There's a lot of duplication exposed here between the `digits` method and the > `getCharsLatin1` method that should be resolved. Can the callers of > `getCharsLatin1` be converted to use `digits`? > > We also should keep HexDigits and

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers

2023-10-16 Thread Shaojin Wen
On Mon, 25 Sep 2023 12:20:36 GMT, Shaojin Wen wrote: >>> The reason why I split it into multiple small methods is to avoid a single >>> method codeSize > 325. After merging small methods, the performance will >>> decrease. >> >> Yes, I can refa

Re: RFR: 8316150: Refactor get chars and string size

2023-10-16 Thread Shaojin Wen
On Wed, 13 Sep 2023 01:24:05 GMT, Shaojin Wen wrote: > 1. Reduce duplicate stringSize code > 2. Move java.lang.StringLatin1.getChars to > jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other > packages also need to use this method @cl4es can you help me to re

Re: RFR: 8316150: Refactor get chars and string size

2023-10-16 Thread Shaojin Wen
On Fri, 22 Sep 2023 12:09:48 GMT, Jim Laskey wrote: >> src/java.base/share/classes/java/util/FormatItem.java line 148: >> >>> 146: int length = DecimalDigits.stringSize(value); >>> 147: this.digits = new byte[length]; >>> 148:

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers

2023-10-16 Thread Shaojin Wen
On Wed, 27 Sep 2023 19:51:25 GMT, Raffaello Giulietti wrote: >> @cl4es made performance optimizations for the simple specifiers of >> String.format in PR https://github.com/openjdk/jdk/pull/2830. Based on the >> same idea, I continued to make improvements. I made patterns like %2d %02d >>

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v3]

2023-10-16 Thread Shaojin Wen
> j.u.Formatter now prints "%tF" (iso standard date) and the result is > incorrect when processing year < 0 or year > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: fix typo - C

Re: RFR: 8316150: Refactor get chars and string size

2023-10-16 Thread Shaojin Wen
On Fri, 22 Sep 2023 04:46:36 GMT, Chen Liang wrote: > Do Octal and Hex digits need int versions of getChars and stringSize? Since DecimalDigits made this change, for consistency, Octal and Hex digits also do the same thing. - PR Comment:

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v2]

2023-10-16 Thread Shaojin Wen
On Mon, 16 Oct 2023 20:36:42 GMT, Naoto Sato wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> No longer localize printed numbers > > test/jdk/java/util/Formatter/BasicDat

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers

2023-10-16 Thread Shaojin Wen
On Mon, 18 Sep 2023 00:48:26 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/java/util/Formatter.java line 3420: >> >>> 3418: && fmt.a instanceof StringBuilder sb >>> 3419: ) { >>> 3420: sb.ap

RFR: 8318200: String::newStringNoRepl and String::getBytesNoRepl does not throw CharacterCodingException

2023-10-16 Thread Shaojin Wen
When calling String::newStringNoRepl and String::getBytesNoRepl, we need to use try...catch to handle CharacterCodingException and throw IllegalArgumentException instead of CharacterCodingException to make the calling code cleaner. - Commit messages: - Make the NoRepl methods

Re: RFR: 8318200: String::newStringNoRepl and String::getBytesNoRepl does not throw CharacterCodingException [v2]

2023-10-16 Thread Shaojin Wen
> When calling String::newStringNoRepl and String::getBytesNoRepl, we need to > use try...catch to handle CharacterCodingException and throw > IllegalArgumentException instead of CharacterCodingException to make the > calling code cleaner. Shaojin Wen has updated the pull request i

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-13 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: use % calculate lowInt - Changes: - all: https://git.openjdk.org/jdk/pull/16006/files - new: https://git.openjdk.

Re: RFR: 8318200: String::newStringNoRepl and String::getBytesNoRepl does not throw CharacterCodingException [v4]

2023-10-17 Thread Shaojin Wen
> When calling String::newStringNoRepl and String::getBytesNoRepl, we need to > use try...catch to handle CharacterCodingException and throw > IllegalArgumentException instead of CharacterCodingException to make the > calling code cleaner. Shaojin Wen has updated the pull request i

Re: RFR: 8318200: String::newStringNoRepl and String::getBytesNoRepl does not throw CharacterCodingException [v3]

2023-10-17 Thread Shaojin Wen
> When calling String::newStringNoRepl and String::getBytesNoRepl, we need to > use try...catch to handle CharacterCodingException and throw > IllegalArgumentException instead of CharacterCodingException to make the > calling code cleaner. Shaojin Wen has updated the pull request i

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-17 Thread Shaojin Wen
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> Big

Re: RFR: 8318200: String::newStringNoRepl and String::getBytesNoRepl does not throw CharacterCodingException [v5]

2023-10-17 Thread Shaojin Wen
> When calling String::newStringNoRepl and String::getBytesNoRepl, we need to > use try...catch to handle CharacterCodingException and throw > IllegalArgumentException instead of CharacterCodingException to make the > calling code cleaner. Shaojin Wen has updated the pull request i

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-17 Thread Shaojin Wen
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> Big

Re: RFR: 8318200: String::newStringNoRepl and String::getBytesNoRepl does not throw CharacterCodingException [v4]

2023-10-17 Thread Shaojin Wen
On Tue, 17 Oct 2023 14:09:08 GMT, Raffaello Giulietti wrote: > @wenshao The proposal changes the exception types for seemingly no reason. > What concrete problem does this enhancement PR address? @lianch 's suggestion in PR #14812 : "Make the NoRepl methods throw IllegalArgument (like

Re: RFR: 8315585: Optimization for decimal to string [v9]

2023-10-19 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: remove JLA - Changes: - all: https://git.openjdk.org/jdk/pull/16006/files - new: https://git.openjdk.org/jd

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v5]

2023-11-06 Thread Shaojin Wen
> j.u.Formatter now prints "%tF" (iso standard date) and the result is > incorrect when processing year < 0 or year > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: use DecimalFormatSymbols#getMinusSign

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v5]

2023-11-07 Thread Shaojin Wen
On Tue, 7 Nov 2023 15:04:16 GMT, Roger Riggs wrote: >> While it might be reasonable to localize using `getMinusSign()` this will >> introduce a new inconsistency with `DateTimeFormatter` (which *does not* >> localize minus signs in front of years): >> >> int minus =

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v5]

2023-11-07 Thread Shaojin Wen
On Sat, 21 Oct 2023 01:22:04 GMT, Shaojin Wen wrote: >> @cl4es made performance optimizations for the simple specifiers of >> String.format in PR https://github.com/openjdk/jdk/pull/2830. Based on the >> same idea, I continued to make improvements. I made patterns like

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v6]

2023-11-07 Thread Shaojin Wen
> j.u.Formatter now prints "%tF" (iso standard date) and the result is > incorrect when processing year < 0 or year > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: Use minus sign from cached DecimalForm

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers

2023-10-30 Thread Shaojin Wen
On Thu, 28 Sep 2023 15:01:25 GMT, Raffaello Giulietti wrote: >> @cl4es made performance optimizations for the simple specifiers of >> String.format in PR https://github.com/openjdk/jdk/pull/2830. Based on the >> same idea, I continued to make improvements. I made patterns like %2d %02d >>

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v4]

2023-11-06 Thread Shaojin Wen
> j.u.Formatter now prints "%tF" (iso standard date) and the result is > incorrect when processing year < 0 or year > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: revert localize change - C

Re: RFR: 8315585: Optimization for decimal to string [v8]

2023-10-18 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: recipe ("\1.\1\1") - Changes: - all: https://git.openjdk.org/jdk/pull/16006/files - new: https://git.open

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v3]

2023-10-19 Thread Shaojin Wen
) > +StringFormat.stringFormat avgt 15 62.619 ? 4.652 ns/op (+2.19) > +StringFormat.stringIntFormat avgt 15 89.606 ? 13.966 ns/op (-2.44) > +StringFormat.widthStringFormat avgt 15 52.462 ? 15.649 ns/op > (+377.95) > +StringFormat.widthStringIntF

Re: RFR: 8315585: Optimization for decimal to string [v3]

2023-10-11 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: fix from @cl4es 's review - Changes: - all: https://git.openjdk.org/jdk/pull/16006/files - new: https://git.op

Re: RFR: 8315585: Optimization for decimal to string [v4]

2023-10-11 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: fix from @cl4es 's review - Changes: - all: https://git.openjdk.org/jdk/pull/16006/files - new: https://git.op

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

2023-10-11 Thread Shaojin Wen
On Wed, 11 Oct 2023 10:30:26 GMT, David Schlosnagle 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

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

2023-10-11 Thread Shaojin Wen
On Tue, 10 Oct 2023 10:22:18 GMT, Chen Liang wrote: >> parseInt & parseLong are accelerated by this code, the key code is here >> >> class DecimalDigits { >> public static int digit(byte ch) { >> return DIGITS_LATIN1[ch & 0xFF]; // If remove & 0xFF it won't get >> faster >> }

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

2023-10-11 Thread Shaojin Wen
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

Re: RFR: 8315585: Optimization for decimal to string [v2]

2023-10-11 Thread Shaojin Wen
On Wed, 11 Oct 2023 09:48:58 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> refactor based on @liach 's review > > src/java.base/share/classes/java/math/BigDeci

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

2023-10-11 Thread Shaojin Wen
On Thu, 12 Oct 2023 00:39:27 GMT, David Schlosnagle wrote: >> 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 something like below. >

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

2023-10-11 Thread Shaojin Wen
On Thu, 12 Oct 2023 02:24:20 GMT, Shaojin Wen wrote: >> More explicitly I was thinking something like below. >> >> I do wonder if some of the benchmark tests should cover the exceptional >> cases. I have seen many systems where attempting to try and parse >>

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

2023-10-11 Thread Shaojin Wen
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, fast-path can improves the performance 10% of

Re: RFR: 8315585: Optimization for decimal to string [v2]

2023-10-11 Thread Shaojin Wen
On Wed, 11 Oct 2023 09:50:20 GMT, Claes Redestad wrote: > I'm not really qualified to review the floating point code. Simplifying away > offset and getting rid of the StringBuilderHelper all seem like good > improvements, though I think it'd be good if we could either avoid or split > out the

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

2023-10-11 Thread Shaojin Wen
On Tue, 10 Oct 2023 08:07:37 GMT, Chen Liang 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 >>

Re: RFR: 8315585: Optimization for decimal to string [v2]

2023-10-11 Thread Shaojin Wen
On Wed, 11 Oct 2023 22:10:45 GMT, Shaojin Wen wrote: >> src/java.base/share/classes/java/math/BigDecimal.java line 4168: >> >>> 4166: int lowInt = (int)intCompact % 100; >>> 4167: int highInt = (int)intCompact / 100; >>> 4168:

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

2023-10-12 Thread Shaojin Wen
On Thu, 12 Oct 2023 09:10:30 GMT, Raffaello Giulietti wrote: >> This patch should have little impact on exception-path performance. Remember >> String concatenation is done with StringBuilder in java.base, so changing >> formatter to that might have some performance difference. However, the

Re: RFR: 8317742: ISO Starndard Date Format implementation consistency on DateTimeFormatter and String.format [v2]

2023-10-12 Thread Shaojin Wen
On Mon, 9 Oct 2023 23:21:57 GMT, Shaojin Wen wrote: >> j.u.Formatter now prints "%tF" (iso standard date) and the result is >> incorrect when processing year < 0 or year > > > Shaojin Wen has updated the pull request incrementally with one additional

Re: RFR: 8316426: Optimization for HexFormat.formatHex [v9]

2023-10-12 Thread Shaojin Wen
On Fri, 6 Oct 2023 14:20:13 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Update full name > > FWIW I'll not review or sponsor any PRs that use `ByteArrayLitt

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

2023-10-12 Thread Shaojin Wen
On Thu, 12 Oct 2023 09:19:35 GMT, Shaojin Wen wrote: >> Let's not forget that `Character.digit()` has a pretty decent fast path for >> Latin1, including a 256 bytes lookup-table. > > CharacterDataLatin1.digit is for multi-radix, and the performance when radix > = 10 is no

Integrated: 8316426: Optimization for HexFormat.formatHex

2023-10-12 Thread Shaojin Wen
On Fri, 15 Sep 2023 18:04:29 GMT, Shaojin Wen wrote: > In the improvement of @cl4es PR #15591, the advantages of non-lookup-table > were discussed. > > But if the input is byte[], using lookup table can improve performance. > > For HexFormat#formatHex(Appendable, byt

Re: RFR: 8315585: Optimization for decimal to string [v5]

2023-10-12 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: refactor based on @cl4es 's review - Changes: - all: https://git.openjdk.org/jdk/pull/16006/files - new: https://g

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v2]

2023-10-17 Thread Shaojin Wen
) > +StringFormat.stringFormat avgt 15 62.619 ? 4.652 ns/op (+2.19) > +StringFormat.stringIntFormat avgt 15 89.606 ? 13.966 ns/op (-2.44) > +StringFormat.widthStringFormat avgt 15 52.462 ? 15.649 ns/op > (+377.95) > +StringFormat.widthStringIntF

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-17 Thread Shaojin Wen
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> Big

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-17 Thread Shaojin Wen
On Tue, 17 Oct 2023 15:56:58 GMT, Chen Liang wrote: > Can you export jfr recordings of two different runs to check? How to do this? I don't know how yet - PR Comment: https://git.openjdk.org/jdk/pull/16006#issuecomment-1767448022

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-18 Thread Shaojin Wen
On Mon, 16 Oct 2023 15:00:42 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> Big

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-19 Thread Shaojin Wen
On Wed, 18 Oct 2023 15:59:31 GMT, Claes Redestad wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use StringConcatFactory.makeConcatWithConstants > > I've opened up #16244 f

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers

2023-10-19 Thread Shaojin Wen
On Thu, 28 Sep 2023 15:01:25 GMT, Raffaello Giulietti wrote: >> @cl4es made performance optimizations for the simple specifiers of >> String.format in PR https://github.com/openjdk/jdk/pull/2830. Based on the >> same idea, I continued to make improvements. I made patterns like %2d %02d >>

Withdrawn: 8318200: String::newStringNoRepl and String::getBytesNoRepl does not throw CharacterCodingException

2023-10-20 Thread Shaojin Wen
On Mon, 16 Oct 2023 22:27:34 GMT, Shaojin Wen wrote: > When calling String::newStringNoRepl and String::getBytesNoRepl, we need to > use try...catch to handle CharacterCodingException and throw > IllegalArgumentException instead of CharacterCodingException to make the > calling

Re: RFR: 8315585: Optimization for decimal to string [v10]

2023-10-20 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen 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 10 additional commits since

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v3]

2023-10-20 Thread Shaojin Wen
On Fri, 20 Oct 2023 08:52:04 GMT, Raffaello Giulietti wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> fix FormatterBuilder testcase handle lineSeparator on windows > > src/jav

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v4]

2023-10-20 Thread Shaojin Wen
) > +StringFormat.stringFormat avgt 15 62.619 ? 4.652 ns/op (+2.19) > +StringFormat.stringIntFormat avgt 15 89.606 ? 13.966 ns/op (-2.44) > +StringFormat.widthStringFormat avgt 15 52.462 ? 15.649 ns/op > (+377.95) > +StringFormat.widthStringIntF

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v5]

2023-10-20 Thread Shaojin Wen
) > +StringFormat.stringFormat avgt 15 62.619 ? 4.652 ns/op (+2.19) > +StringFormat.stringIntFormat avgt 15 89.606 ? 13.966 ns/op (-2.44) > +StringFormat.widthStringFormat avgt 15 52.462 ? 15.649 ns/op > (+377.95) > +StringFormat.widthStringIntF

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-21 Thread Shaojin Wen
On Thu, 19 Oct 2023 11:58:26 GMT, Claes Redestad wrote: >> @cl4es >> >>> Good, narrows it down to what's going on in `prepend(long, byte[], >>> String)`. Might boil down to `System.arraycopy`. This method might not be >>> optimized for tiny arrays on all platforms. Specializing for

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-22 Thread Shaojin Wen
On Thu, 19 Oct 2023 10:22:19 GMT, Raffaello Giulietti wrote: >> I've opened up #16244 for review - thanks for helping with analysis and >> verification. > > @cl4es @wenshao I'd like to review the mathematical aspects of these changes > once the refactorings with string concatenations have

Re: RFR: 8315585: Optimization for decimal to string [v11]

2023-10-21 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: reduce duplicate code & code format & refactor benchmark case - Changes: - all: https://git.openjdk.org/jd

Re: RFR: 8315585: Optimization for decimal to string [v7]

2023-10-23 Thread Shaojin Wen
On Thu, 19 Oct 2023 11:58:26 GMT, Claes Redestad wrote: >> @cl4es >> >>> Good, narrows it down to what's going on in `prepend(long, byte[], >>> String)`. Might boil down to `System.arraycopy`. This method might not be >>> optimized for tiny arrays on all platforms. Specializing for

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-15 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> Big

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-13 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> Big

Re: RFR: 8315585: Optimization for decimal to string [v6]

2023-10-13 Thread Shaojin Wen
On Fri, 13 Oct 2023 17:01:11 GMT, Shaojin Wen wrote: >> I submitted PR #1 before, and there were too many changes. I split it >> into multiple PRs with small changes. This one is one of them. >> >> this PR removed the duplicate code for getChars in >> Big

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

2023-10-24 Thread Shaojin Wen
rformance 10% of > parseInt(String)/parseLong(String). Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits: - merge from master - Merge remote-tracking branch 'upstream/master' into parse_int_long # Conflic

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v8]

2023-11-09 Thread Shaojin Wen
> j.u.Formatter now prints "%tF" (iso standard date) and the result is > incorrect when processing year < 0 or year > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: fix format 'ja-JP-u-ca-jap

Re: RFR: 8315585: Optimization for decimal to string [v13]

2023-11-09 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: revert use JLA - Changes: - all: https://git.openjdk.org/jdk/pull/16006/files - new: https://git.openjdk.org/jd

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v7]

2023-11-09 Thread Shaojin Wen
> j.u.Formatter now prints "%tF" (iso standard date) and the result is > incorrect when processing year < 0 or year > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: fix format 'ja-JP-u-ca-jap

Re: RFR: 8315585: Optimization for decimal to string [v12]

2023-11-09 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits: - merge from master - Merge remote-tracking branch 'upstream/master' into optim_decimal_to_string_x1

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v7]

2024-01-21 Thread Shaojin Wen
) > +StringFormat.stringFormat avgt 15 62.619 ? 4.652 ns/op (+2.19) > +StringFormat.stringIntFormat avgt 15 89.606 ? 13.966 ns/op (-2.44) > +StringFormat.widthStringFormat avgt 15 52.462 ? 15.649 ns/op > (+377.95) > +StringFormat.widthStringIntF

Integrated: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers

2024-02-06 Thread Shaojin Wen
On Sun, 17 Sep 2023 16:01:33 GMT, Shaojin Wen wrote: > @cl4es made performance optimizations for the simple specifiers of > String.format in PR https://github.com/openjdk/jdk/pull/2830. Based on the > same idea, I continued to make improvements. I made patterns like %2d %02

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v6]

2023-12-21 Thread Shaojin Wen
On Thu, 21 Dec 2023 08:37:23 GMT, Shaojin Wen wrote: >> @cl4es made performance optimizations for the simple specifiers of >> String.format in PR https://github.com/openjdk/jdk/pull/2830. Based on the >> same idea, I continued to make improvements. I made patterns like

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v6]

2023-12-21 Thread Shaojin Wen
) > +StringFormat.stringFormat avgt 15 62.619 ? 4.652 ns/op (+2.19) > +StringFormat.stringIntFormat avgt 15 89.606 ? 13.966 ns/op (-2.44) > +StringFormat.widthStringFormat avgt 15 52.462 ? 15.649 ns/op > (+377.95) > +StringFormat.widthStringIntF

Re: RFR: 8315585: Optimization for decimal to string [v14]

2023-12-21 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 17 commits: - Merge remote-tracking branch 'upstream/master' into optim_decimal_to_string_x1 - revert use JLA -

Re: RFR: 8315585: Optimization for decimal to string [v15]

2024-01-21 Thread Shaojin Wen
e review and don't hesitate to critique my approach and patch. Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 19 commits: - Merge remote-tracking branch 'upstream/master' into optim_decimal_to_string_x1 - Merge remote-trackin

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v10]

2023-11-18 Thread Shaojin Wen
> j.u.Formatter now prints "%tF" (iso standard date) and the result is > incorrect when processing year < 0 or year > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: add JapaneseChronology testcase

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v9]

2023-11-18 Thread Shaojin Wen
> j.u.Formatter now prints "%tF" (iso standard date) and the result is > incorrect when processing year < 0 or year > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: use t.query(TemporalQueries.ch

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v8]

2023-11-18 Thread Shaojin Wen
On Sun, 19 Nov 2023 01:52:13 GMT, Naoto Sato wrote: >> JapaneseChronology is an IsoChronology so run the test again (before >> committing) to make sure. > > `JapaneseChronology` is not extending `IsoChronology`, and that is the gist > of the change I suggested. I added the testcase of

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v6]

2023-11-16 Thread Shaojin Wen
On Thu, 9 Nov 2023 17:15:02 GMT, Naoto Sato wrote: >> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use minus sign from cached DecimalFormatSymbols and improved testcase > > Looks like you

Withdrawn: 8315585: Optimization for decimal to string

2023-11-13 Thread Shaojin Wen
On Mon, 4 Sep 2023 04:58:08 GMT, Shaojin Wen wrote: > BigDecimal is a commonly used class in business development, It is often > necessary to perform toString or toPlainString operations on BigDecimal. > > The current version uses StringBuilder resulting in multiple memory >

Re: RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v11]

2023-11-20 Thread Shaojin Wen
> j.u.Formatter now prints "%tF" (iso standard date) and the result is > incorrect when processing year < 0 or year > Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision: update copyright - C

Re: RFR: 8316704: Regex-free parsing of Formatter and FormatProcessor specifiers [v5]

2023-11-20 Thread Shaojin Wen
On Sat, 21 Oct 2023 01:22:04 GMT, Shaojin Wen wrote: >> @cl4es made performance optimizations for the simple specifiers of >> String.format in PR https://github.com/openjdk/jdk/pull/2830. Based on the >> same idea, I continued to make improvements. I made patterns like

Integrated: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format

2023-11-21 Thread Shaojin Wen
On Tue, 3 Oct 2023 21:37:46 GMT, Shaojin Wen wrote: > j.u.Formatter now prints "%tF" (iso standard date) and the result is > incorrect when processing year < 0 or year > This pull request has now been integrated. Changeset: 61d81d64 Author:Shaojin Wen Comm

Withdrawn: 8327429: String Template FMT built-in optimization for DateTimes

2024-04-19 Thread Shaojin Wen
On Wed, 4 Oct 2023 22:30:42 GMT, Shaojin Wen wrote: > # Goal > Improve String Template FMT's processing performance of date types. > Currently, FMT processes date types by toString and then calls > j.u.Formatter#print. Because there is less parse processing than >

Withdrawn: 8326617: String Template FMT removes unnecessary int to long type cast

2024-04-19 Thread Shaojin Wen
On Mon, 2 Oct 2023 23:05:29 GMT, Shaojin Wen wrote: > In the current version, FMT."v =%d{1}" will call the > StringConcatHelper.prepend(long/byte[]/long) method, which should behave the > same as STR."v ={1}". Call StringConcatHelper.prepend(long/byte[]/int), >

Withdrawn: 8327425: String Template FMT Refactor use call direct instead of MethodHandle

2024-04-19 Thread Shaojin Wen
On Tue, 3 Oct 2023 06:19:11 GMT, Shaojin Wen wrote: > Currently FormatItem uses MethodHandler to handle latin1 and utf16, which is > not readable. This PR uses direct calls instead of MethodHandle. > > Please review and don't hesitate to critique my approach and patch. This pull

Re: RFR: 8327791: Optimization for new BigDecimal(String) [v17]

2024-04-23 Thread Shaojin Wen
reate a char[] > > > boolean isCompact = (len <= MAX_COMPACT_DIGITS); // 18 > if (!isCompact) { > // ... > } else { > char[] coeff = new char[len]; // allocate char[] > // ... > } > > > This PR eliminates the two memory allocations mentioned above,

Re: RFR: 8327791: Optimization for new BigDecimal(String) [v18]

2024-04-25 Thread Shaojin Wen
reate a char[] > > > boolean isCompact = (len <= MAX_COMPACT_DIGITS); // 18 > if (!isCompact) { > // ... > } else { > char[] coeff = new char[len]; // allocate char[] > // ... > } > > > This PR eliminates the two memory allocations mentioned above,

Re: RFR: 8327791: Optimization for new BigDecimal(String) [v10]

2024-04-25 Thread Shaojin Wen
On Fri, 26 Apr 2024 02:04:38 GMT, Joe Darcy wrote: >>> @cl4es @jddarcy All feedback has been fixed, can it be integrated? >> >> Hello @wenshao , >> >> This change will need additional review from myself or others who maintain >> BigDecimal before it can be integrated. > >> @jddarcy Sorry for

Re: RFR: 8327791: Optimization for new BigDecimal(String) [v18]

2024-04-27 Thread Shaojin Wen
On Fri, 26 Apr 2024 05:48:03 GMT, Shaojin Wen wrote: >> The current BigDecimal(String) constructor calls String#toCharArray, which >> has a memory allocation. >> >> >> public BigDecimal(String val) { >> this(val.toCharArray(), 0, val.length()); //

  1   2   >