For Programmers: Free Programming Magazines  


Home > Archive > Smalltalk > June 2004 > [VW 7.1] isNil ifTrue:versus ifNil:









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [VW 7.1] isNil ifTrue:versus ifNil:
Andre Schnoor

2004-06-15, 8:57 am

I experienced that
anObject isNil ifTrue:[ ... ]

is a lot faster than
anObject ifNil:[ ... ]

How comes? I'm now busy rewriting all occurences of #ifNil: (as well as
#ifNotNil:) in my app. I first thought it was the other way around and
started using ifNil: whenever possible. It seemed to me one execution step
was ommited. But it seems the compiler optimization of #ifTrue: does a great
job.

Am I doing the right thing?

Andre



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com