Re: Towards a JSON API for the JDK

2025-05-17 Thread Cay Horstmann
+1 for having a JSON battery included with the JDK. And for "Our primary goal is that the library be simple to use for parsing, traversing, and generating conformant JSON documents." Generating JSON could be easier. Why not convenience methods Json.newObject and Json.newArray like in https://g

Re: RFR: 8351443: Improve robustness of StringBuilder [v9]

2025-05-17 Thread Chen Liang
On Sat, 17 May 2025 15:04:21 GMT, Markus KARG wrote: >> Roger Riggs has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Removed extraneous "the" > > src/java.base/share/classes/java/lang/StringUTF16.java line 1535: > >> 1533: checkB

Re: RFR: 8351443: Improve robustness of StringBuilder [v9]

2025-05-17 Thread Markus KARG
On Fri, 9 May 2025 16:41:39 GMT, Roger Riggs wrote: >> Refactor AbstractStringBuilder to maintain consistency among count, coder, >> and value buffers while the buffer capacity is being expanded and/or >> inflated from Latin1 to UTF16 representations. >> The refactoring pattern is to read and

RFC: 8357183: Improving efficiency of Writer::append(CharSequence) and Writer::append(CharSequence, int, int) / Sub Task of 8356679: Using CharSequence::getChars internally

2025-05-17 Thread Markus KARG
Roger, thank you for your comments. Following your advice I have splitted the larger work of JDK-8356679 into sub tasks. I would like to start with a first PR implementing the *foundational* work, i. e. optimizing Writer::append for efficiency (JDK-8357183). For convenience, attached below

Re: RFR: 8355177: Speed up StringBuilder::append(char[]) via Unsafe::copyMemory [v4]

2025-05-17 Thread Shaojin Wen
On Fri, 2 May 2025 07:13:21 GMT, Shaojin Wen wrote: >>> ```java >>> > char[] ca = new char[end - off]; >>> ``` >>> >>> Your code here has a memory allocation, which may cause slowdown >> >> This is exactly what I wanted to express with my posting. > >> > ```java >> > > char[] ca

Re: RFR: 8350607: Consolidate MethodHandles::zero into MethodHandles::constant [v2]

2025-05-17 Thread ExE Boss
On Mon, 24 Feb 2025 23:45:37 GMT, Chen Liang wrote: >> LF editor spins classes, this avoids the spinning overhead and should speed >> up non-capturing lambdas too. >> >> There may need to be additional intrinsic work for MH combinator lf bytecode >> generation. > > Chen Liang has updated the p

Re: RFR: 8350607: Consolidate MethodHandles::zero into MethodHandles::constant [v2]

2025-05-17 Thread Chen Liang
On Sat, 17 May 2025 14:32:43 GMT, ExE Boss wrote: >> Chen Liang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> We no longer load DelegateMH as we no longer rebind > > src/java.base/share/classes/java/lang/invoke/MethodHandles.java line

Re: RFR: 8355177: Speed up StringBuilder::append(char[]) via Unsafe::copyMemory [v4]

2025-05-17 Thread Markus KARG
On Fri, 2 May 2025 07:13:21 GMT, Shaojin Wen wrote: >>> ```java >>> > char[] ca = new char[end - off]; >>> ``` >>> >>> Your code here has a memory allocation, which may cause slowdown >> >> This is exactly what I wanted to express with my posting. > >> > ```java >> > > char[] ca

Re: Towards a JSON API for the JDK

2025-05-17 Thread Ethan McCue
I think it's worth noting that the way you used the prospective API in your ONNX code is not representative of how the API would generally be used in a jdk-only scenario. Custom making a general transformation from JsonValue -> Record is outside the ken of i'd say most. I'd be interested in an expe

Re: RFR: 8077587: BigInteger Roots [v15]

2025-05-17 Thread fabioromano1
On Wed, 14 May 2025 18:48:50 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Revert "Use type long for bitLength instead of int" >> >> This reverts commit c8e1b8159206d9fb5532df7ccdf9

Re: Towards a JSON API for the JDK

2025-05-17 Thread Ethan McCue
I think we should pull apart those concerns a little: I am of the opinion that the API is more important at this stage than the actual implementation, save for the places where having an API of a particular shape mandates implementation choices. > The JsonNull/JsonNumber/JsonString/JsonValue here