On Wed, 23 Apr 2025 14:05:58 GMT, Per Minborg <pminb...@openjdk.org> wrote:
> This PR is based on the work of @mernst-github and aims to implement an > _internal_ thread-local 'stack' allocator, which works like a dynamically > sized arena, but with reset functionality to reset the allocated size back to > a certain level. The underlying memory could stay around between calls, which > could improve performance. > > Re-allocated segments are not zeroed between allocations. Here are the current benchmark results: Benchmark (ELEM_SIZE) Mode Cnt Score Error Units BufferStackBench.OfVirtual.buffer 8 avgt 15 12.653 ± 0.180 ns/op BufferStackBench.OfVirtual.buffer 16 avgt 15 12.573 ± 0.121 ns/op BufferStackBench.OfVirtual.buffer 32 avgt 15 12.712 ± 0.252 ns/op BufferStackBench.OfVirtual.confined 8 avgt 15 22.714 ± 0.146 ns/op BufferStackBench.OfVirtual.confined 16 avgt 15 24.269 ± 1.079 ns/op BufferStackBench.OfVirtual.confined 32 avgt 15 25.519 ± 0.219 ns/op BufferStackBench.buffer 8 avgt 15 4.866 ± 0.141 ns/op BufferStackBench.buffer 16 avgt 15 4.829 ± 0.106 ns/op BufferStackBench.buffer 32 avgt 15 4.809 ± 0.071 ns/op BufferStackBench.confined 8 avgt 15 22.768 ± 0.448 ns/op BufferStackBench.confined 16 avgt 15 23.380 ± 0.192 ns/op BufferStackBench.confined 32 avgt 15 25.874 ± 1.129 ns/op and Benchmark Mode Cnt Score Error Units CallOverheadByValue.OfVirtual.byPtr avgt 15 4.140 ± 0.054 ns/op CallOverheadByValue.OfVirtual.byValue avgt 15 16.698 ± 0.347 ns/op CallOverheadByValue.byPtr avgt 15 4.120 ± 0.028 ns/op CallOverheadByValue.byValue avgt 15 11.828 ± 0.082 ns/op > Can we just cleanly revert commit > [7764742](https://github.com/openjdk/jdk/commit/77647421c5b13738f6fa145bf30cbb9dd741e164)? > This new version defines redundant sealed interface + record - feels > unnecessary to me. > Meanwhile, the BufferStackBench is valueable, but its addition should be kept > in a separate commit to make reviewing easier. The idea was to use records for trusted components and less boilerplate. The idea with the interface was to hide the record accessors a bit. ------------- PR Comment: https://git.openjdk.org/jdk/pull/24829#issuecomment-2824439716 PR Comment: https://git.openjdk.org/jdk/pull/24829#issuecomment-2824676176