RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer

Per Minborg pminborg at openjdk.org
Thu Oct 31 08:54:32 UTC 2024


On Tue, 29 Oct 2024 14:51:33 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable to inlining and generally improving performance.
> 
> Testing successfully on tier1-3

I've added a very similar benchmark to the PR which I've run with a Mac M1:


$ make test TEST="micro:java.lang.foreign.SegmentOfBuffer" MICRO="OPTIONS=-prof gc"

Benchmark                                               Mode  Cnt   Score    Error   Units
SegmentOfBuffer.ofBuffer                                avgt   30   1.225 ?  0.025   ns/op
SegmentOfBuffer.ofBuffer:gc.alloc.rate                  avgt   30   0.013 ?  0.001  MB/sec
SegmentOfBuffer.ofBuffer:gc.alloc.rate.norm             avgt   30  ? 10??             B/op
SegmentOfBuffer.ofBuffer:gc.count                       avgt   30     ? 0           counts
SegmentOfBuffer.ofBufferInlineFalse                     avgt   30   1.221 ?  0.019   ns/op
SegmentOfBuffer.ofBufferInlineFalse:gc.alloc.rate       avgt   30   0.013 ?  0.001  MB/sec
SegmentOfBuffer.ofBufferInlineFalse:gc.alloc.rate.norm  avgt   30  ? 10??             B/op
SegmentOfBuffer.ofBufferInlineFalse:gc.count            avgt   30     ? 0           counts
SegmentOfBuffer.ofBufferInlineTrue                      avgt   30   1.212 ?  0.010   ns/op
SegmentOfBuffer.ofBufferInlineTrue:gc.alloc.rate        avgt   30   0.013 ?  0.001  MB/sec
SegmentOfBuffer.ofBufferInlineTrue:gc.alloc.rate.norm   avgt   30  ? 10??             B/op
SegmentOfBuffer.ofBufferInlineTrue:gc.count             avgt   30     ? 0           counts

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21764#issuecomment-2449342833


More information about the core-libs-dev mailing list