Re: RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths [v2]

2024-09-13 Thread Maurizio Cimadamore
On Thu, 12 Sep 2024 12:44:41 GMT, Per Minborg wrote: >> This PR proposes to add a new overload to `MemorySegment::getString` whereby >> it is possible to pass in a known byte length of the content in a segment >> that should be converted to a String. This is useful in case one already >> knows

Re: RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths [v2]

2024-09-12 Thread Maurizio Cimadamore
On Thu, 12 Sep 2024 13:44:34 GMT, Maurizio Cimadamore wrote: >> Per Minborg 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 >> co

Re: RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths [v2]

2024-09-12 Thread Maurizio Cimadamore
On Thu, 12 Sep 2024 12:44:41 GMT, Per Minborg wrote: >> This PR proposes to add a new overload to `MemorySegment::getString` whereby >> it is possible to pass in a known byte length of the content in a segment >> that should be converted to a String. This is useful in case one already >> knows

Re: RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths [v2]

2024-09-12 Thread Per Minborg
> This PR proposes to add a new overload to `MemorySegment::getString` whereby > it is possible to pass in a known byte length of the content in a segment > that should be converted to a String. This is useful in case one already > knows the byte length and thereby does not need to scan for a nu

Re: RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths

2024-08-28 Thread Maurizio Cimadamore
On Wed, 28 Aug 2024 09:57:42 GMT, Maurizio Cimadamore wrote: > Ok, I suppose what you do get is the auto-detection of charset length, which > adjusts the size of the copy... NVM, this is not what this impl is doing. I see no performance benefit for using the new API over a `copy`. If so, this

Re: RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths

2024-08-28 Thread Maurizio Cimadamore
On Tue, 27 Aug 2024 09:36:56 GMT, Per Minborg wrote: > This PR proposes to add a new overload to `MemorySegment::getString` whereby > it is possible to pass in a known byte length of the content in a segment > that should be converted to a String. This is useful in case one already > knows the

Re: RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths

2024-08-28 Thread Maurizio Cimadamore
On Wed, 28 Aug 2024 09:56:43 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 1316: >> >>> 1314: >>> 1315: /** >>> 1316: * Reads a string using the given byte length from this segment >>> at the given offset, >> >> What happens

Re: RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths

2024-08-28 Thread Maurizio Cimadamore
On Wed, 28 Aug 2024 09:52:10 GMT, Maurizio Cimadamore wrote: >> This PR proposes to add a new overload to `MemorySegment::getString` whereby >> it is possible to pass in a known byte length of the content in a segment >> that should be converted to a String. This is useful in case one already

Re: RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths

2024-08-28 Thread Maurizio Cimadamore
On Tue, 27 Aug 2024 09:36:56 GMT, Per Minborg wrote: > This PR proposes to add a new overload to `MemorySegment::getString` whereby > it is possible to pass in a known byte length of the content in a segment > that should be converted to a String. This is useful in case one already > knows the

RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths

2024-08-27 Thread Per Minborg
This PR proposes to add a new overload to `MemorySegment::getString` whereby it is possible to pass in a known byte length of the content in a segment that should be converted to a String. This is useful in case one already knows the byte length and thereby does not need to scan for a null termi