<?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: CFSwitch Hunt</title>
	<atom:link href="http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/</link>
	<description>Web Application Engineers</description>
	<lastBuildDate>Mon, 05 Dec 2011 17:24:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Brad Wood</title>
		<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/comment-page-1/#comment-94</link>
		<dc:creator>Brad Wood</dc:creator>
		<pubDate>Wed, 21 Nov 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2006/6/28/20060727042244#comment-94</guid>
		<description>Good news.  I got around to trying this in CF8 today and the problem seems to be resolved.</description>
		<content:encoded><![CDATA[<p>Good news.  I got around to trying this in CF8 today and the problem seems to be resolved.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/comment-page-1/#comment-93</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Wed, 07 Feb 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2006/6/28/20060727042244#comment-93</guid>
		<description>Hey Andy. Yes, we did talk directly with some of our contacts on the ColdFusion engineering team, and this was a confirmed problem/bug. They acknowledged it to us and elsewhere around the Web.

It should be noted that this is only a problem with &lt;cfswitch&gt; inside of loops, particularly large loops. We got lots of questions on this from Fusebox 3 customers along the lines of--do we need to rewrite all our fbx_switch files!? The answer is very definitely no. You shouldn&#039;t see any performance problems with a single pass over a switch statement. However, if you&#039;ve got a switch statement with a string expression inside even a small loop--say, 100 iterations--then you&#039;ll almost certainly see a performance boost by changing those to the equivalent if-else block.

The tipping point would probably vary a bit for different applications. In the case of our customer, the loops were above 1,000 iterations. You&#039;d have to test your system specifically to see what your tipping point is.

I&#039;ve posted (above) a version of the tests we ran to document the initial performance differences. Later tests were a bit more complicated, but this gives you the gist.</description>
		<content:encoded><![CDATA[<p>Hey Andy. Yes, we did talk directly with some of our contacts on the ColdFusion engineering team, and this was a confirmed problem/bug. They acknowledged it to us and elsewhere around the Web.</p>
<p>It should be noted that this is only a problem with &lt;cfswitch&gt; inside of loops, particularly large loops. We got lots of questions on this from Fusebox 3 customers along the lines of&#8211;do we need to rewrite all our fbx_switch files!? The answer is very definitely no. You shouldn&#8217;t see any performance problems with a single pass over a switch statement. However, if you&#8217;ve got a switch statement with a string expression inside even a small loop&#8211;say, 100 iterations&#8211;then you&#8217;ll almost certainly see a performance boost by changing those to the equivalent if-else block.</p>
<p>The tipping point would probably vary a bit for different applications. In the case of our customer, the loops were above 1,000 iterations. You&#8217;d have to test your system specifically to see what your tipping point is.</p>
<p>I&#8217;ve posted (above) a version of the tests we ran to document the initial performance differences. Later tests were a bit more complicated, but this gives you the gist.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Matthews</title>
		<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/comment-page-1/#comment-92</link>
		<dc:creator>Andy Matthews</dc:creator>
		<pubDate>Mon, 29 Jan 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2006/6/28/20060727042244#comment-92</guid>
		<description>Have there been any updates to this? Has Adobe contacted you about this and commented? At my company, we use case statements all the time and it would really suck for this to be true.

I also have some of the same questions as others. Is there a tipping point at which one becomes more efficient than the other?

Also, do you have any code you could offer for use in testing?</description>
		<content:encoded><![CDATA[<p>Have there been any updates to this? Has Adobe contacted you about this and commented? At my company, we use case statements all the time and it would really suck for this to be true.</p>
<p>I also have some of the same questions as others. Is there a tipping point at which one becomes more efficient than the other?</p>
<p>Also, do you have any code you could offer for use in testing?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Dinowitz</title>
		<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/comment-page-1/#comment-85</link>
		<dc:creator>Michael Dinowitz</dc:creator>
		<pubDate>Tue, 01 Aug 2006 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2006/6/28/20060727042244#comment-85</guid>
		<description>I just want to be 100% sure before I make a change to a piece of high traffic logging code on House of Fusion. Your saying that this code segment:
		CFSWITCH expression=&quot;#arguments.agent#&quot;
			CFCASE value=&quot;Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)&quot;
				CFRETURN 20
			/CFCASE
			CFCASE value=&quot;Googlebot/2.1 (+http://www.google.com/bot.html)&quot;
				CFRETURN 12
			/CFCASE
/CFSWITCH

Will run slower than this one:
			CFIF Not CompareNoCase(arguments.agent, &#039;Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)&#039;)
				CFRETURN 20
			CFELSEIF Not CompareNoCase(arguments.agent, &#039;Googlebot/2.1 (+http://www.google.com/bot.html)&#039;)
				CFRETURN 12
			/CFIF

Is there a break point on the amount of cases/CFELSEIFs that will show a performance gain? Such as 10 CFCases or better show the CFSWITCH to be better than 9 CFELSEIFs when dealing with strings.</description>
		<content:encoded><![CDATA[<p>I just want to be 100% sure before I make a change to a piece of high traffic logging code on House of Fusion. Your saying that this code segment:<br />
		CFSWITCH expression=&quot;#arguments.agent#&quot;<br />
			CFCASE value=&quot;Mozilla/5.0 (compatible; Yahoo! Slurp; <a href="http://help.yahoo.com/help/us/ysearch/slurp)&#038;quot" rel="nofollow">http://help.yahoo.com/help/us/ysearch/slurp)&#038;quot</a>;<br />
				CFRETURN 20<br />
			/CFCASE<br />
			CFCASE value=&quot;Googlebot/2.1 (+http://www.google.com/bot.html)&quot;<br />
				CFRETURN 12<br />
			/CFCASE<br />
/CFSWITCH</p>
<p>Will run slower than this one:<br />
			CFIF Not CompareNoCase(arguments.agent, &#8216;Mozilla/5.0 (compatible; Yahoo! Slurp; <a href="http://help.yahoo.com/help/us/ysearch/slurp)" rel="nofollow">http://help.yahoo.com/help/us/ysearch/slurp)</a>&#8216;)<br />
				CFRETURN 20<br />
			CFELSEIF Not CompareNoCase(arguments.agent, &#8216;Googlebot/2.1 (+http://www.google.com/bot.html)&#8217;)<br />
				CFRETURN 12<br />
			/CFIF</p>
<p>Is there a break point on the amount of cases/CFELSEIFs that will show a performance gain? Such as 10 CFCases or better show the CFSWITCH to be better than 9 CFELSEIFs when dealing with strings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Dinowitz</title>
		<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/comment-page-1/#comment-86</link>
		<dc:creator>Michael Dinowitz</dc:creator>
		<pubDate>Tue, 01 Aug 2006 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2006/6/28/20060727042244#comment-86</guid>
		<description>On the previous comment, is it better to use a number of smaller CFIF statements or one large CFIF/CFELSEIF where possible?</description>
		<content:encoded><![CDATA[<p>On the previous comment, is it better to use a number of smaller CFIF statements or one large CFIF/CFELSEIF where possible?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barry.b</title>
		<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/comment-page-1/#comment-88</link>
		<dc:creator>barry.b</dc:creator>
		<pubDate>Sat, 29 Jul 2006 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2006/6/28/20060727042244#comment-88</guid>
		<description>wow.

I&#039;m cringing at my old projects floating around with this not-obvious time bomb in it... all for the sake of code readability...

you contacted any CF engineers about this? the forthcomming CF8 &#039;n&#039; all...</description>
		<content:encoded><![CDATA[<p>wow.</p>
<p>I&#8217;m cringing at my old projects floating around with this not-obvious time bomb in it&#8230; all for the sake of code readability&#8230;</p>
<p>you contacted any CF engineers about this? the forthcomming CF8 &#8216;n&#8217; all&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Al Everett</title>
		<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/comment-page-1/#comment-87</link>
		<dc:creator>Al Everett</dc:creator>
		<pubDate>Fri, 28 Jul 2006 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2006/6/28/20060727042244#comment-87</guid>
		<description>You don&#039;t mention a version number. Was it CFMX7.x? Would you surmise that it would happen in CFMX as well?</description>
		<content:encoded><![CDATA[<p>You don&#8217;t mention a version number. Was it CFMX7.x? Would you surmise that it would happen in CFMX as well?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary Fenton</title>
		<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/comment-page-1/#comment-89</link>
		<dc:creator>Gary Fenton</dc:creator>
		<pubDate>Fri, 28 Jul 2006 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2006/6/28/20060727042244#comment-89</guid>
		<description>Thank you so much for blogging your findings. I&#039;ve always found cfswitch awkward to use (perhaps because I have to type a few more chars?) but recently I made the effort to switch to cfswitch because the CF docs state that this is more efficient. I quote: &quot;The cfswitch tag provides better performance than a series of cfif/cfelseif tags, and the code is easier to read.&quot;

Your findings fly in the face of the docs so I hope Adobe will take note, investigate this matter and amend the docs if necessary. Now I can return to using lovely CFIF tags. :-)</description>
		<content:encoded><![CDATA[<p>Thank you so much for blogging your findings. I&#8217;ve always found cfswitch awkward to use (perhaps because I have to type a few more chars?) but recently I made the effort to switch to cfswitch because the CF docs state that this is more efficient. I quote: &#8220;The cfswitch tag provides better performance than a series of cfif/cfelseif tags, and the code is easier to read.&#8221;</p>
<p>Your findings fly in the face of the docs so I hope Adobe will take note, investigate this matter and amend the docs if necessary. Now I can return to using lovely CFIF tags. <img src='http://www.webapper.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Brooks-Bilson</title>
		<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/comment-page-1/#comment-90</link>
		<dc:creator>Rob Brooks-Bilson</dc:creator>
		<pubDate>Thu, 27 Jul 2006 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2006/6/28/20060727042244#comment-90</guid>
		<description>You all submit this to the CF Engineering team?  Seems like it might be useful information they could use in tuning Scorpio.</description>
		<content:encoded><![CDATA[<p>You all submit this to the CF Engineering team?  Seems like it might be useful information they could use in tuning Scorpio.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Nadel</title>
		<link>http://www.webapper.com/blog/index.php/2006/07/27/20060727042244/comment-page-1/#comment-91</link>
		<dc:creator>Ben Nadel</dc:creator>
		<pubDate>Thu, 27 Jul 2006 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2006/6/28/20060727042244#comment-91</guid>
		<description>This is very interesting indeed! It really goes against what I had thought to be true. But I am a huge proponent of the idea that the proof is in the pudding (mmm, pudding). If tests say strings are slower in swtich, then I believe it. Thanks for doing the tests.</description>
		<content:encoded><![CDATA[<p>This is very interesting indeed! It really goes against what I had thought to be true. But I am a huge proponent of the idea that the proof is in the pudding (mmm, pudding). If tests say strings are slower in swtich, then I believe it. Thanks for doing the tests.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

