[foreign-memaccess+abi] RFR: Add AllocTest benchmark [v2]

Jorn Vernee jvernee at openjdk.org
Fri Aug 18 17:27:16 UTC 2023


On Fri, 18 Aug 2023 17:22:11 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This patch adds a benchmark that tests a simple allocation (of varying size).
>> The allocation request requires zeroing, so we compare against calloc, and bare use of Unsafe::allocateMemory/setMemory/freeMemory.
>> 
>> Results are as follows:
>> 
>> 
>> Benchmark                     (size)  Mode  Cnt   Score   Error  Units
>> AllocTest.alloc_calloc_arena       5  avgt   30  40.620 ? 0.360  ns/op
>> AllocTest.alloc_calloc_arena      20  avgt   30  41.648 ? 1.460  ns/op
>> AllocTest.alloc_calloc_arena     100  avgt   30  39.885 ? 0.478  ns/op
>> AllocTest.alloc_calloc_arena     500  avgt   30  67.802 ? 2.258  ns/op
>> AllocTest.alloc_calloc_arena    1000  avgt   30  67.403 ? 1.034  ns/op
>> AllocTest.alloc_confined           5  avgt   30  51.874 ? 0.554  ns/op
>> AllocTest.alloc_confined          20  avgt   30  52.717 ? 1.214  ns/op
>> AllocTest.alloc_confined         100  avgt   30  52.760 ? 0.716  ns/op
>> AllocTest.alloc_confined         500  avgt   30  58.661 ? 2.379  ns/op
>> AllocTest.alloc_confined        1000  avgt   30  65.374 ? 0.711  ns/op
>> AllocTest.alloc_unsafe_arena       5  avgt   30  56.086 ? 0.710  ns/op
>> AllocTest.alloc_unsafe_arena      20  avgt   30  52.492 ? 0.835  ns/op
>> AllocTest.alloc_unsafe_arena     100  avgt   30  54.579 ? 0.748  ns/op
>> AllocTest.alloc_unsafe_arena     500  avgt   30  60.528 ? 1.024  ns/op
>> AllocTest.alloc_unsafe_arena    1000  avgt   30  67.619 ? 1.020  ns/op
>> 
>> 
>> So, confined arenas are quite close to calloc. There remains a gap, especially on lower allocation sizes, which is a consequence of:
>> https://bugs.openjdk.org/browse/JDK-8314294
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address review comments

Marked as reviewed by jvernee (Committer).

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

PR Review: https://git.openjdk.org/panama-foreign/pull/870#pullrequestreview-1584942094


More information about the panama-dev mailing list