<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: The Optimized Null Check Pattern</title>
	<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/</link>
	<description>Down To The Bone</description>
	<pubDate>Thu, 16 Oct 2008 07:12:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: Christophe</title>
		<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3602</link>
		<pubDate>Thu, 13 Apr 2006 01:13:08 +0000</pubDate>
		<guid>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3602</guid>
					<description>&lt;p&gt;Darn !
and I implemented all my methods like this&lt;/p&gt;

&lt;p&gt;public void myMethod() throws NullPointerException {
...
}
I guess I need to refactor back to your solution right ?&lt;/p&gt;

&lt;p&gt;;)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Darn !
and I implemented all my methods like this</p>

<p>public void myMethod() throws NullPointerException {
&#8230;
}
I guess I need to refactor back to your solution right ?</p>

<p>;)</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Patrick Calahan</title>
		<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3599</link>
		<pubDate>Fri, 07 Apr 2006 18:34:27 +0000</pubDate>
		<guid>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3599</guid>
					<description>&lt;p&gt;You gotta send this to thedailywtf.com.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You gotta send this to thedailywtf.com.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: nolose</title>
		<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3592</link>
		<pubDate>Wed, 05 Apr 2006 10:02:16 +0000</pubDate>
		<guid>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3592</guid>
					<description>&lt;p&gt;Ok the sniplet is fine and ingenious, but you must have a big big balls to call pattern to that.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ok the sniplet is fine and ingenious, but you must have a big big balls to call pattern to that.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Tom Hawtin</title>
		<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3591</link>
		<pubDate>Wed, 05 Apr 2006 08:26:14 +0000</pubDate>
		<guid>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3591</guid>
					<description>&lt;p&gt;I've seen coding standards that say you should try to dereference a potential null, rather than check it explicitly. It's not totally implausible. Over the last week or so, I've been trying to shave cycles off some seriously optimised code (removing the null-check didn't help).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;ve seen coding standards that say you should try to dereference a potential null, rather than check it explicitly. It&#8217;s not totally implausible. Over the last week or so, I&#8217;ve been trying to shave cycles off some seriously optimised code (removing the null-check didn&#8217;t help).</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Marko Schulz</title>
		<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3590</link>
		<pubDate>Wed, 05 Apr 2006 08:25:23 +0000</pubDate>
		<guid>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3590</guid>
					<description>&lt;p&gt;I actually looked up LogRecord because I couldn't believe the code is in there. There is a reason, why people consider comments a code smell. Or may there really be a hidden reason why the author didn't write an explicit check?&lt;/p&gt;

&lt;p&gt;if (level == null) {
    throw new IllegalArgumentExecption();
  }&lt;/p&gt;

&lt;p&gt;At least the call of getClass() is smarter than toString() because the former is final native. &lt;/p&gt;

&lt;p&gt;BTW: Exceptions shouldn't be used for the normal control flow, but AFAIK it isn't true anymore that throwing and catching exceptions is &lt;em&gt;that&lt;/em&gt; expensive.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I actually looked up LogRecord because I couldn&#8217;t believe the code is in there. There is a reason, why people consider comments a code smell. Or may there really be a hidden reason why the author didn&#8217;t write an explicit check?</p>

<p>if (level == null) {
    throw new IllegalArgumentExecption();
  }</p>

<p>At least the call of getClass() is smarter than toString() because the former is final native. </p>

<p>BTW: Exceptions shouldn&#8217;t be used for the normal control flow, but AFAIK it isn&#8217;t true anymore that throwing and catching exceptions is <em>that</em> expensive.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: ian</title>
		<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3589</link>
		<pubDate>Tue, 04 Apr 2006 22:43:49 +0000</pubDate>
		<guid>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3589</guid>
					<description>&lt;p&gt;I thought so, but I thought since you didn't actually pop any stack frames, maybe java had some nice optimizations.&lt;/p&gt;

&lt;p&gt;:)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I thought so, but I thought since you didn&#8217;t actually pop any stack frames, maybe java had some nice optimizations.</p>

<p>:)</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Jonas</title>
		<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3588</link>
		<pubDate>Tue, 04 Apr 2006 22:11:08 +0000</pubDate>
		<guid>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3588</guid>
					<description>&lt;p&gt;I guess I should have added a ;-) (winky face) at the end or posted it in the 'Fun' or 'Joke' category...but I just thought that it was already very obvious that the post was soaked with sarcasm...&lt;/p&gt;

&lt;p&gt;...don't always take life so seriously... :-)&lt;/p&gt;

&lt;p&gt;(btw, Ian: if it is null then it is &lt;em&gt;definitely not&lt;/em&gt; faster, throwing an exception is one of the most expensive things you can do - something that sort of contributed to the fun...eh...)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I guess I should have added a <img src='http://jonasboner.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  (winky face) at the end or posted it in the &#8216;Fun&#8217; or &#8216;Joke&#8217; category&#8230;but I just thought that it was already very obvious that the post was soaked with sarcasm&#8230;</p>

<p>&#8230;don&#8217;t always take life so seriously&#8230; <img src='http://jonasboner.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p>(btw, Ian: if it is null then it is <em>definitely not</em> faster, throwing an exception is one of the most expensive things you can do - something that sort of contributed to the fun&#8230;eh&#8230;)</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: ian</title>
		<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3587</link>
		<pubDate>Tue, 04 Apr 2006 21:38:29 +0000</pubDate>
		<guid>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3587</guid>
					<description>&lt;p&gt;If it is null it may be faster, but if it is not null, calling toString() could be bad.  This method could have been overloaded to take O(n) or worse.  So you are doing the method call (including a vtable lookup), running the method, the method must create a string, and return it.  How is this faster than an if statement?'&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ian&lt;/li&gt;
&lt;/ul&gt;
</description>
		<content:encoded><![CDATA[<p>If it is null it may be faster, but if it is not null, calling toString() could be bad.  This method could have been overloaded to take O(n) or worse.  So you are doing the method call (including a vtable lookup), running the method, the method must create a string, and return it.  How is this faster than an if statement?&#8217;</p>

<ul>
<li>ian</li>
</ul>
]]></content:encoded>
				</item>
	<item>
		<title>by: Tom Hawtin</title>
		<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3586</link>
		<pubDate>Tue, 04 Apr 2006 21:12:52 +0000</pubDate>
		<guid>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3586</guid>
					<description>&lt;p&gt;Has it been tested to check that it really is faster? It's not like the check takes any significant time at all. Taken at face value toString and getClass do substantially more. Someone told me the other day that HotSpot will often turn a busy null-check into a trap.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Has it been tested to check that it really is faster? It&#8217;s not like the check takes any significant time at all. Taken at face value toString and getClass do substantially more. Someone told me the other day that HotSpot will often turn a busy null-check into a trap.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Oliver Moehrke</title>
		<link>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3585</link>
		<pubDate>Tue, 04 Apr 2006 17:59:09 +0000</pubDate>
		<guid>http://jonasboner.com/2006/04/04/the-optimized-null-check-pattern/#comment-3585</guid>
					<description>&lt;p&gt;I guess stories like that are created on april 1st, aren't they? Or is that just a german tradition?&lt;/p&gt;

&lt;p&gt;On the other hand: using reflection could help to tweak it even more :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I guess stories like that are created on april 1st, aren&#8217;t they? Or is that just a german tradition?</p>

<p>On the other hand: using reflection could help to tweak it even more <img src='http://jonasboner.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
				</item>
</channel>
</rss>
