Nope, that's a lie.  Instantiating CFCs is quite expensive, but method
calls on an existing instance are very fast.  I just ran some tests,
and found that a CFINCLUDE takes about twice as much time as a method
invocation on a CFC.  Both are quite slower than inline code, of
course, but with inline code you don't get any reusability, and I
think we all agree that isn't very desirable.

The test was simply <cfset 1 + 1 /> wrapped in three different ways:
inline, in an include, and in a CFC method.  I ran a loop of 10,000
iterations across each one (after running them earlier to avoid
cache-related speed differences), and found that the inline code took
10-15 ms, the CFINCLUDE took around 400 ms, and the CFC method
invocation took around 200 ms.  I also ran a static invocation of the
same CFC method, just for reference, and it was appallingly slow:
about 6,000 ms.

This is on a AMD Athlon XP 2200 running at 1.8 gHz with "enough" RAM
(several hundred MB free throughout), RedHat 8.0, CFMX 6.1 Enterprise
(WAR on JRUN), Apache 2, and the trusted template cache turned off.

cheers,
barneyb

On 8/22/05, Munson, Jacob <[EMAIL PROTECTED]> wrote:
> Well, that's all fine and good.  But what about processor time?  I've
> heard that CFCs make a significant hit to the processor when compared to
> just running code in the page.  Its probably negligible for just one or
> two CFC calls, but if you are calling 10 CFCs in a page, and those CFCs
> are in turn invoking others, it could add up quick (probably
> exponentially).
> 

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to