[squeak-dev] The Trunk: System-cwp.660.mcz
Eliot Miranda
eliot.miranda at gmail.com
Fri Jan 10 22:33:00 UTC 2014
On Thu, Jan 9, 2014 at 6:35 AM, Colin Putney <colin at wiresong.com> wrote:
>
>
>
> 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.
>
It's the other way around. #or: is inlined into jump bytecodes. #| is a
real send.
>
> Colin
>
>
>
>
>
--
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140110/13f99982/attachment.htm
More information about the Squeak-dev
mailing list
|