[squeak-dev] The Trunk: System-cwp.660.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Jan 9 16:11:41 UTC 2014


2014/1/9 Colin Putney <colin at wiresong.com>

>
>
>
> On Thu, Jan 9, 2014 at 2:01 AM, Levente Uzonyi <leves at elte.hu> wrote:
>
>
>> Also, I prefer the lazy #or: over #|, because it's faster.
>
>
> Normally, yes, but in this case, I think #| is actually faster. Consider
> the two versions (without the bug):
>
> a)  (lastObject == object) | (object == 0)
>
> b) (lastObject == object) or: [object == 0]
>
> Lazy evaluation doesn't help here, because the first comparison will
> almost never be true. On the other hand, #== is very fast, because it's a
> bytecode, whereas #or: involves an extra message send and creating a stack
> frame to execute the block.
>
> Colin
>
> err, yes, lazyness don't pay, but no, #or: is inlined by compiler as a
conditional jump...
It's the contrary, #| is a message send.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140109/9661f1dd/attachment.htm


More information about the Squeak-dev mailing list