[foreign-memaccess+abi] RFR: 8313238: Improve the performance of strlen for null-terminated strings
Radoslaw Smogura
duke at openjdk.org
Thu Aug 3 14:14:00 UTC 2023
On Thu, 3 Aug 2023 13:52:27 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> This PR proposes to use native calls for determining the string length for C-type strings.
>
> Smaller segments (<1024 bytes) is using a trivial call whereas all other segments are using a normal call. We might consider always using regular calls if we think most segments are unbound anyhow.
>
> The PR also contains a number of new tests, one of which requires a large heap size to run. It is likely that this latter test will not run in most test environments. In such cases, it is silently ignored.
src/java.base/share/classes/jdk/internal/foreign/StringSupport.java line 123:
> 121: segment = segment.asSlice(start);
> 122: }
> 123: long len = segment.byteSize() < MAX_TRIVIAL_SIZE
When calling `strlen` should it be considered if segments is heap or off-heap?
-------------
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/857#discussion_r1283265679
More information about the panama-dev
mailing list