EndOfStream unused

nicolas cellier ncellier at ifrance.com
Thu Nov 8 23:40:09 UTC 2007


To close the nextIfAtEnd: alternative see micro benchmarks (source and 
results) at http://bugs.squeak.org/view.php?id=6755.

Paolo Bonzini a écrit :
> 
>> Why would it kill performance?  The block is created at the first
>> call, and thereafter a reference to it is past, no?  That sounds
>> pretty fast to me.
> 
> If you run this:
> 
>     [ self next == nil ] whileTrue: [ ... ]
> 
> and Stream>>next is this
> 
>     ^self nextIfAtEnd: [ ^ nil ]
> 
> every time you invoke #next, it you create a new 
> BlockContext/BlockClosure, and that makes it impossible to exploit LIFO 
> behavior for thisContext.  It kills performance.
> 

Yeah, implementing default next like this is definitely a no go

> Paolo
> 
> 




More information about the Squeak-dev mailing list