[foreign-memaccess+abi] RFR: MemorySegmentPool + Allocator [v13]

Aungkhant884 duke at openjdk.org
Thu Oct 19 00:07:26 UTC 2023


On Tue, 27 Apr 2021 22:31:52 GMT, Radoslaw Smogura <duke at openjdk.org> wrote:

>> (Preview)
>> 
>> The MemorySegmentPool is a pool maintaining memory segments, optionally can expose allocator which can be bound to other scope, and which will return allocated segments back to pool.
>> 
>> However the best results has been achieved by using getSegmentEntry & putSegmentEntry methods.
>> 
>> The pool is intended to be used by long running applications (i.e. like global shared pool), where fast allocation and de-allocation of segments is critical (was designed during implementation of I/O subsystem with Panama, as a pool for temporary buffers between system I/O methods and Java byte arrays from InputStreams).
>> 
>> The pool uses hand-made SpinLockQueue as the Deque from JDK offers too much functionality and overhead.
>
> Radoslaw Smogura has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Make acquire of parent (pool scope) optional - 5ns per ops / down.
>   
>   ```StrLenTest.panama_strlen_arena                               5  avgt   10   35.290 ?   1.756  ns/op
>     StrLenTest.panama_strlen_arena                              20  avgt   10   54.778 ?   3.094  ns/op
>     StrLenTest.panama_strlen_arena                             100  avgt    3   97.301 ? 137.266  ns/op
>     StrLenTest.panama_strlen_memsegmentpool_allocator            5  avgt   10   46.160 ?   0.654  ns/op
>     StrLenTest.panama_strlen_memsegmentpool_allocator           20  avgt   10   52.966 ?   1.095  ns/op
>     StrLenTest.panama_strlen_memsegmentpool_allocator          100  avgt   10   66.377 ?   0.878  ns/op
>     StrLenTest.panama_strlen_memsegmentpool_allocator_copy       5  avgt   10   47.412 ?   1.073  ns/op
>     StrLenTest.panama_strlen_memsegmentpool_allocator_copy      20  avgt   10   52.349 ?   1.296  ns/op
>     StrLenTest.panama_strlen_memsegmentpool_allocator_copy     100  avgt   10   79.623 ?   1.616  ns/op
>     StrLenTest.panama_strlen_prefix                              5  avgt   10   27.352 ?   0.659  ns/op
>     StrLenTest.panama_strlen_prefix                             20  avgt   10   33.634 ?   0.081  ns/op
>     StrLenTest.panama_strlen_prefix                            100  avgt   10   49.974 ?   0.097  ns/op
>     StrLenTest.panama_strlen_unsafe                              5  avgt   10   51.266 ?   0.558  ns/op
>     StrLenTest.panama_strlen_unsafe                             20  avgt   10   63.194 ?   0.360  ns/op
>     StrLenTest.panama_strlen_unsafe                            100  avgt   10   60.800 ?   0.821  ns/op
>     StrLenTest.panama_strlen_unsafe_trivial                      5  avgt   10   27.343 ?   0.094  ns/op
>     StrLenTest.panama_strlen_unsafe_trivial                     20  avgt   10   32.997 ?   0.383  ns/op
>     StrLenTest.panama_strlen_unsafe_trivial                    100  avgt   10   49.065 ?   0.756  ns/op
>    ```

Thanks

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

Marked as reviewed by Aungkhant884 at github.com (no known OpenJDK username).

PR Review: https://git.openjdk.org/panama-foreign/pull/509#pullrequestreview-1680844774


More information about the panama-dev mailing list