On Sep 19, 2023, at 4:14 AM, Marcel Taeumel via Squeak-dev <squeak-dev@lists.squeakfoundation.org> wrote:
Hi all --[ #() isEmpty ifTrue: ['hallo'] ifFalse: ['squeak'] ] bench'127,000,000 per second. 7.85 nanoseconds per run. 0 % GC time.'[ #() ifEmpty: ['hallo'] ifNotEmpty: ['squeak'] ] bench7,580,000 per second. 132 nanoseconds per run. 78.0088 % GC time.'Why is that? :-) Why is there an extra GC?Here is the current implementation of #ifEmpty:ifNotEmpty:ifEmpty: emptyBlock ifNotEmpty: notEmptyBlock
self isEmpty ifTrue: [^ emptyBlock value].
^ notEmptyBlock cull: selfBest,Marcel