Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!cam-news-feed3.bbnplanet.com!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!howland.erols.net!netcom.com!pencin
From: pencin@smalltalkbrewery.com (Russell Pencin)
Subject: Re: Q: isNil OR: == nil ??
Message-ID: <pencinE1G4rp.BnC@netcom.com>
Sender: pencin@netcom11.netcom.com
Organization: The Smalltalk Brewey, Inc.
X-Newsreader: Forte Free Agent 1.0.82
References: <3285F093.339F@kommsrv.rz.unibw-muenchen.de> <LIEBELT.96Nov11111336@gaston.arsnova.com>
Date: Mon, 25 Nov 1996 23:52:03 GMT
Lines: 44

liebelt@gaston.arsnova.com (Markus Liebelt) wrote:
>Code:
>Time millisecondsToRun: 
>    [100000 timesRepeat:
>	[nil == nil]	"1."
>	"[nil isNil]"	"2."
>	"[]"		"3."
>    ]

Sorry for the late posting of this, just catching up!


You might be surprised to find that the inverse of this test do not
work so well - beware of ~~ -vs- notNil!

Code:
Time millisecondsToRun: 
    [100000 timesRepeat:
	[nil ~~ nil]	"1."
	"[nil notNil]"	"2."
	"[]"		"3."
    ]

1.  38 ms
2. 14 ms
3. 10 ms

Smalltalk has always been a positive logic machine - now you see why!


Russ


*----------------------------------------------------------*
      Check out the WEB page - www.smalltalkbrewery.com
*----------------------------------------------------------*
Russell L. Pencin                  | Smalltalk Training
The Smalltalk Brewery, Inc         | Smalltalk Mentoring
(415) 961-8948 (V)                 | Visualworks Training
(415) 964-4356 (F)                 | Speed and Space Tuning
*==========================================================*
*   Handcrafted Objects with only the finest ingredients   *
*==========================================================*

