On Fri, 2 May 2025 14:11:19 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>>> any reason why you didn't use a lambda here?
>> 
>> I also think that CleanupAction should be changed to lambda
>
> Using an anonymous class for the cleanup action had very adverse effects on 
> performance. I didn't want to use a lambda for startup performance reasons.

If using lambda affects performance, how about using anonymous classes?

            return new PerThread(new ReentrantLock(),
                    arena,
                    new SlicingAllocator(arena.allocate(byteSize, 
byteAlignment)),
                    new Consumer<MemorySegment>() {
                        @Override
                        public void accept(MemorySegment memorySegment) {
                            Reference.reachabilityFence(arena);
                        }});

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24829#discussion_r2071839071

Reply via email to