If you are using cfinvoke it will re-instantiate the component each call
unless you return the component as a variable.
I would be more inclined to use the following only because I think it is
neater.
<cfset object = createObject('component', 'componentCFC').init() /> <!---
the init function needs to have return this --->
This then gets a handle to the object and you can use multiple calls like
this.
<cfset object.method1() />
<cfset object.method2() />
<cfset object.method3() />
<cfset object.method4() />
In a single page, and it will be a lot faster. You can do the same with
cfinvoke to return the object, but like I said the code sample I gave is
much neater in my opinion.
-----Original Message-----
From: Robert Bell [mailto:[email protected]]
Sent: Thursday, 10 June 2010 1:34 AM
To: cf-talk
Subject: CF8 Component/Cfinvoke performance
Hello all,
I am having an issue where I have created a Book CFC that is taking way too
long to cfinvoke. I had to convert it to a cffunction to get the
permformance
I needed. The cfc lived in the directory of the template path being used
for the cfinvoke, so I assumed that was a relatively efficient way to do it?
What can I look at that would affect the component invoking speed ? Is
there any way not to have to cfinvoke so many times, and cache/reuse the
component structure in mem and just put the current data in it (and not
cfinvoke alot ) ? I am not explicity tearing down the structures, just
doing cfinvokes in loops with new book isbn's etc. I am a cfcomponent
newbie, so be gentle.. :) I would really not have to use functions, and be
able to make calls to this remotely, but I am at a loss where to change it.
It performs fine as a function, just not as a component. Any ideas
appreciated.
Thanks,
Bob
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334416
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm