On Tue, 4 Mar 2025 19:37:32 GMT, Vladimir Ivanov <[email protected]> wrote:
>> test setup was updated to generate data of requested size.
>
> Vladimir Ivanov has updated the pull request incrementally with one
> additional commit since the last revision:
>
> JDK-8350811 [JMH] test foreign.StrLenTest failed with
> StringIndexOutOfBoundsException for size=451
test/micro/org/openjdk/bench/java/lang/foreign/StrLenTest.java line 149:
> 147: while (lorem.length() < size) {
> 148: lorem += lorem;
> 149: }
This is matter of taste, but I would prefer StringBuilder instead:
StringBuilder builder = new StringBuilder(lorem.length()+size);
for (int l = 0; l<size; l+=lorem.length()) {
builder.append(lorem);
}
return builder.substring(0, size);
test/micro/org/openjdk/bench/java/lang/foreign/StrLenTest.java line 181:
> 179:
> 180: static class SlicingPool {
> 181: final MemorySegment pool;
This seems ok; though I was suspicious but I can't measure a difference: with
the default parameters for size of 5, 20, 100, arena was 10x-200x+ times
bigger. Now it fits exactly.
I measured 1x, 10x, 100x (for size 1500 and 15000) and results appear
consistent.
So, this is just a note; looks good
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23873#discussion_r1982330072
PR Review Comment: https://git.openjdk.org/jdk/pull/23873#discussion_r1982357391