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

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Aug 18 16:53:04 UTC 2023


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

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

Commit messages:
 - Add AllocTest benchmark

Changes: https://git.openjdk.org/panama-foreign/pull/870/files
 Webrev: https://webrevs.openjdk.org/?repo=panama-foreign&pr=870&range=00
  Stats: 147 lines in 1 file changed: 147 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/panama-foreign/pull/870.diff
  Fetch: git fetch https://git.openjdk.org/panama-foreign.git pull/870/head:pull/870

PR: https://git.openjdk.org/panama-foreign/pull/870


More information about the panama-dev mailing list