[squeak-dev] The Trunk: System-cwp.660.mcz
Colin Putney
colin at wiresong.com
Thu Jan 9 14:35:48 UTC 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140109/eabf243f/attachment.htm
More information about the Squeak-dev
mailing list
|