<?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"
	>
<channel>
	<title>Comments on: What is it with the Coldfusion Compiler?</title>
	<atom:link href="http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/feed/" rel="self" type="application/rss+xml" />
	<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/</link>
	<description></description>
	<pubDate>Fri, 10 Oct 2008 23:00:31 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Neil</title>
		<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-37</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Fri, 08 Dec 2006 09:31:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.feed-squirrel.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-37</guid>
		<description>@Rod Hilton - I guess my point here is "why?" - why would I want to have so much overhead for something that acheives the same end effect?

@TomK  - I ran the file on it's own with no other CF - and I took an average runtime from a lot of requests.

@Todd - Yup, it was off

@Edward - This is something else that stumps me.  You would have thought that CFScript and CFTags go through the same compiler and end up with the same net result - but as you can see, that is clearly not the case (and why is one so much faster?)

@Sean - I see what you are saying, but again why?  Why would I want to write some CF (and therefore adopt a hefty license cost at the same time) when the equivalent JSP ( in a lot of cases and leveraging JSTL) is not any harder to do but has better performance (and I would guess better reliability as there is less links in the chain)?</description>
		<content:encoded><![CDATA[<p>@Rod Hilton - I guess my point here is &#8220;why?&#8221; - why would I want to have so much overhead for something that acheives the same end effect?</p>
<p>@TomK  - I ran the file on it&#8217;s own with no other CF - and I took an average runtime from a lot of requests.</p>
<p>@Todd - Yup, it was off</p>
<p>@Edward - This is something else that stumps me.  You would have thought that CFScript and CFTags go through the same compiler and end up with the same net result - but as you can see, that is clearly not the case (and why is one so much faster?)</p>
<p>@Sean - I see what you are saying, but again why?  Why would I want to write some CF (and therefore adopt a hefty license cost at the same time) when the equivalent JSP ( in a lot of cases and leveraging JSTL) is not any harder to do but has better performance (and I would guess better reliability as there is less links in the chain)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aidan Kane</title>
		<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-36</link>
		<dc:creator>Aidan Kane</dc:creator>
		<pubDate>Fri, 08 Dec 2006 09:15:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.feed-squirrel.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-36</guid>
		<description>I understand (roughly) the differences in implementation that cause the effects we're seeing, but I don't think trying to slow JSP down to make the test a bit fairer is the right way to go.

Instead we should be asking ourselves - 'what will CF give me that JSP will not do?' and futher to that - 'what solutions/frameworks exist to give us that functionality?'</description>
		<content:encoded><![CDATA[<p>I understand (roughly) the differences in implementation that cause the effects we&#8217;re seeing, but I don&#8217;t think trying to slow JSP down to make the test a bit fairer is the right way to go.</p>
<p>Instead we should be asking ourselves - &#8216;what will CF give me that JSP will not do?&#8217; and futher to that - &#8216;what solutions/frameworks exist to give us that functionality?&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Corfield</title>
		<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-35</link>
		<dc:creator>Sean Corfield</dc:creator>
		<pubDate>Fri, 08 Dec 2006 04:41:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.feed-squirrel.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-35</guid>
		<description>Let's try this:

&#60;%
long start = java.lang.System.currentTimeMillis();

Object result = new Long(0);
Object limit = new Long(1000000);for (Object i = new Long(0); ((Long)i).longValue() &#60;= ((Long)limit).longValue(); i = new Long(((Long)i).longValue() + 1))
{
result = new Long(((Long)result).longValue() + ((Long)i).longValue());
}
%&#62;

&#60;%=result %&#62;
&#60;BR&#62;
Execution Time: &#60;%= java.lang.System.currentTimeMillis() - start %&#62;ms.</description>
		<content:encoded><![CDATA[<p>Let&#8217;s try this:</p>
<p>&lt;%<br />
long start = java.lang.System.currentTimeMillis();</p>
<p>Object result = new Long(0);<br />
Object limit = new Long(1000000);for (Object i = new Long(0); ((Long)i).longValue() &lt;= ((Long)limit).longValue(); i = new Long(((Long)i).longValue() + 1))<br />
{<br />
result = new Long(((Long)result).longValue() + ((Long)i).longValue());<br />
}<br />
%&gt;</p>
<p>&lt;%=result %&gt;<br />
&lt;BR&gt;<br />
Execution Time: &lt;%= java.lang.System.currentTimeMillis() - start %&gt;ms.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Corfield</title>
		<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-34</link>
		<dc:creator>Sean Corfield</dc:creator>
		<pubDate>Fri, 08 Dec 2006 04:31:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.feed-squirrel.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-34</guid>
		<description>Aww... my source code got eaten!

I'll repost with angle brackets escaped...</description>
		<content:encoded><![CDATA[<p>Aww&#8230; my source code got eaten!</p>
<p>I&#8217;ll repost with angle brackets escaped&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Corfield</title>
		<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-33</link>
		<dc:creator>Sean Corfield</dc:creator>
		<pubDate>Fri, 08 Dec 2006 04:30:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.feed-squirrel.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-33</guid>
		<description>I ran your code and on first execution got around 4.5 seconds. On subsequent executions it was around 1.5 seconds. Still a big difference from what you see with JSP (which on my system executes in about 8ms on first hit and 4ms on subsequent hits).

You'd be closer comparing it to code like this:





Execution Time: ms.

The execution time of this is around 130ms. That's around 30x slower than the example with pure builtin types.

Now, yes, there's still one order of magnitude between my JSP above and CF's time but there's a lot of additional machinery in the CF code.

You need to bear in mind that all of these little performance comparisons we see are testing completely unrealistic code fragments.

After all, how many real world program actually perform a numeric addition 1,000,000 times in a single request? You need to look at the real world difference under load of typical requests - stuff that talks to databases and does simple string processing...</description>
		<content:encoded><![CDATA[<p>I ran your code and on first execution got around 4.5 seconds. On subsequent executions it was around 1.5 seconds. Still a big difference from what you see with JSP (which on my system executes in about 8ms on first hit and 4ms on subsequent hits).</p>
<p>You&#8217;d be closer comparing it to code like this:</p>
<p>Execution Time: ms.</p>
<p>The execution time of this is around 130ms. That&#8217;s around 30x slower than the example with pure builtin types.</p>
<p>Now, yes, there&#8217;s still one order of magnitude between my JSP above and CF&#8217;s time but there&#8217;s a lot of additional machinery in the CF code.</p>
<p>You need to bear in mind that all of these little performance comparisons we see are testing completely unrealistic code fragments.</p>
<p>After all, how many real world program actually perform a numeric addition 1,000,000 times in a single request? You need to look at the real world difference under load of typical requests - stuff that talks to databases and does simple string processing&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth Petry-Johnson</title>
		<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-32</link>
		<dc:creator>Seth Petry-Johnson</dc:creator>
		<pubDate>Thu, 07 Dec 2006 21:10:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.feed-squirrel.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-32</guid>
		<description>I'm no expert, but you might be seeing the result of a compiler optimization. In the Java loop, if the compiler realizes that all you're doing is looping x number of times and incrementing a counter each time, with no side effects to worry about, it might translate that into a single set statement and avoid the loop altogether. 

Since CF is weakly typed there will be a bunch of extra code that is generated "under the hood". That extra code might prevent the compiler from making the same optimizations and resulting in a loop with a million iterations.

You might want to add something non-trivial to the body of the loop, such as a method call or dynamic mathematical expression, and then re-run your test.</description>
		<content:encoded><![CDATA[<p>I&#8217;m no expert, but you might be seeing the result of a compiler optimization. In the Java loop, if the compiler realizes that all you&#8217;re doing is looping x number of times and incrementing a counter each time, with no side effects to worry about, it might translate that into a single set statement and avoid the loop altogether. </p>
<p>Since CF is weakly typed there will be a bunch of extra code that is generated &#8220;under the hood&#8221;. That extra code might prevent the compiler from making the same optimizations and resulting in a loop with a million iterations.</p>
<p>You might want to add something non-trivial to the body of the loop, such as a method call or dynamic mathematical expression, and then re-run your test.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edward Smith</title>
		<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-30</link>
		<dc:creator>Edward Smith</dc:creator>
		<pubDate>Thu, 07 Dec 2006 20:18:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.feed-squirrel.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-30</guid>
		<description>Doing it in CFScript drops it by a factor of 5 for me.

I went from 1200ms for the tag version to 175ms for this script version.


start = getTickCount();
result = 0;
for (i=1; i lte 1000000; i=i+1)
{
result=result+i;
}
writeoutput("#result#Execution Time: #getTickCount() - start#ms");
</description>
		<content:encoded><![CDATA[<p>Doing it in CFScript drops it by a factor of 5 for me.</p>
<p>I went from 1200ms for the tag version to 175ms for this script version.</p>
<p>start = getTickCount();<br />
result = 0;<br />
for (i=1; i lte 1000000; i=i+1)<br />
{<br />
result=result+i;<br />
}<br />
writeoutput(&#8221;#result#Execution Time: #getTickCount() - start#ms&#8221;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd</title>
		<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-29</link>
		<dc:creator>Todd</dc:creator>
		<pubDate>Thu, 07 Dec 2006 20:12:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.feed-squirrel.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-29</guid>
		<description>Did you have debugging turned on?  Go turn it off and look at the difference.</description>
		<content:encoded><![CDATA[<p>Did you have debugging turned on?  Go turn it off and look at the difference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vinceb</title>
		<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-28</link>
		<dc:creator>vinceb</dc:creator>
		<pubDate>Thu, 07 Dec 2006 19:48:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.feed-squirrel.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-28</guid>
		<description>I wrote a blog entry a while ago that talks about this:

&lt;a target="_blank" href="http://tinyurl.com/yen594" rel="nofollow"&gt;http://tinyurl.com/yen594&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>I wrote a blog entry a while ago that talks about this:</p>
<p><a target="_blank" href="http://tinyurl.com/yen594" rel="nofollow">http://tinyurl.com/yen594</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: &#187; Under The Hood: How the ColdFusion Compiler Works : devnulled: a blog by brandon harper</title>
		<link>http://neilmiddleton.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-27</link>
		<dc:creator>&#187; Under The Hood: How the ColdFusion Compiler Works : devnulled: a blog by brandon harper</dc:creator>
		<pubDate>Thu, 07 Dec 2006 19:37:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.feed-squirrel.com/2006/12/07/what-is-it-with-the-coldfusion-compiler/#comment-27</guid>
		<description>[...] We&#8217;ve talked about how CF translates into Java many times over the past couple of years and some of the inherent performance problems with weak typing (at some point it still has to be converted back to static typing&#8211; this is a basic theoretical problem that any dynamically typed language has), and I showed my co-worker (and primarily Java programmer) Rod the &#8220;what is wrong with the ColdFusion compiler&#8221; post, and he has a very well written response to how ColdFusion translates its own dynamically typed tag based syntax down to statically typed Java code. Of course the high level Computer Science answer would just be &#8220;a parser-generator, duh&#8221;, but instead he goes into the details of how everything must be eventually cast/typed. He doesn&#8217;t really ever do any ColdFusion, so be easy on him in the comments if you have a bone to pick on the CF side. [...]</description>
		<content:encoded><![CDATA[<p>[...] We&#8217;ve talked about how CF translates into Java many times over the past couple of years and some of the inherent performance problems with weak typing (at some point it still has to be converted back to static typing&#8211; this is a basic theoretical problem that any dynamically typed language has), and I showed my co-worker (and primarily Java programmer) Rod the &#8220;what is wrong with the ColdFusion compiler&#8221; post, and he has a very well written response to how ColdFusion translates its own dynamically typed tag based syntax down to statically typed Java code. Of course the high level Computer Science answer would just be &#8220;a parser-generator, duh&#8221;, but instead he goes into the details of how everything must be eventually cast/typed. He doesn&#8217;t really ever do any ColdFusion, so be easy on him in the comments if you have a bone to pick on the CF side. [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
