<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: isDefined() vs structKeyExists()</title>
	<atom:link href="http://www.simonwhatley.co.uk/isdefined-vs-structkeyexists/feed" rel="self" type="application/rss+xml" />
	<link>http://www.simonwhatley.co.uk/isdefined-vs-structkeyexists</link>
	<description>The opposite of every great idea is another great idea</description>
	<lastBuildDate>Tue, 24 Jan 2012 10:54:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Robert Farber</title>
		<link>http://www.simonwhatley.co.uk/isdefined-vs-structkeyexists/comment-page-1#comment-96</link>
		<dc:creator>Robert Farber</dc:creator>
		<pubDate>Mon, 19 Jan 2009 10:02:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=341#comment-96</guid>
		<description>structKeyExists()  is the way to go.</description>
		<content:encoded><![CDATA[<p>structKeyExists()  is the way to go.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Thornton</title>
		<link>http://www.simonwhatley.co.uk/isdefined-vs-structkeyexists/comment-page-1#comment-95</link>
		<dc:creator>Paul Thornton</dc:creator>
		<pubDate>Mon, 24 Sep 2007 16:08:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=341#comment-95</guid>
		<description>I dropped using isDefined() many moons ago as well, I thought it was common knowledge that isDefined() was inefficient and structKeyExists() was the way to go.

Well, reading around and coming across &lt;a href=&quot;http://www.placona.co.uk/blog/index.cfm/2006/11/30/Performance-Test-isDefined-x-structKeyExists&quot; rel=&quot;nofollow&quot;&gt;Marcos Placona&#039;s blog&lt;/a&gt; where he has conducted a test, it turns out, to my amazement, structKeyExists() is slower then isDefined()!

The key here is that isDefined() is super-fast when the scope exists, i.e. isDefined(&quot;session.userID&quot;), but mega-slow if a non-existent scope is used, e.g. isDefined(&quot;unknownStruct.userID&quot;).

structKeyExists() is consistent regardless of what you provide.

So, as long as you are asking for a SCOPED variable that is extant, isDefined will be faster on average!

structKeyExists(), may be comparatively slower, but forces scoping, which is good practice.</description>
		<content:encoded><![CDATA[<p>I dropped using isDefined() many moons ago as well, I thought it was common knowledge that isDefined() was inefficient and structKeyExists() was the way to go.</p>
<p>Well, reading around and coming across <a href="http://www.placona.co.uk/blog/index.cfm/2006/11/30/Performance-Test-isDefined-x-structKeyExists" rel="nofollow">Marcos Placona&#8217;s blog</a> where he has conducted a test, it turns out, to my amazement, structKeyExists() is slower then isDefined()!</p>
<p>The key here is that isDefined() is super-fast when the scope exists, i.e. isDefined(&#8220;session.userID&#8221;), but mega-slow if a non-existent scope is used, e.g. isDefined(&#8220;unknownStruct.userID&#8221;).</p>
<p>structKeyExists() is consistent regardless of what you provide.</p>
<p>So, as long as you are asking for a SCOPED variable that is extant, isDefined will be faster on average!</p>
<p>structKeyExists(), may be comparatively slower, but forces scoping, which is good practice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russell Brown</title>
		<link>http://www.simonwhatley.co.uk/isdefined-vs-structkeyexists/comment-page-1#comment-94</link>
		<dc:creator>Russell Brown</dc:creator>
		<pubDate>Mon, 24 Sep 2007 11:58:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=341#comment-94</guid>
		<description>I also believe there is another performance factor with isDefined. When you execute something like isDefined(&quot;session.user&quot;) is checks other scopes for the key as well  such as variables.session.user and request.session.user. I stopped using isDefined() all together years ago now and I&#039;m not sure of a reason why to use it, unless maybe you don&#039;t know what scope the var will be in [variable, form, url].</description>
		<content:encoded><![CDATA[<p>I also believe there is another performance factor with isDefined. When you execute something like isDefined(&#8220;session.user&#8221;) is checks other scopes for the key as well  such as variables.session.user and request.session.user. I stopped using isDefined() all together years ago now and I&#8217;m not sure of a reason why to use it, unless maybe you don&#8217;t know what scope the var will be in [variable, form, url].</p>
]]></content:encoded>
	</item>
</channel>
</rss>

