Function calling from components
Hello,
Just a query on 2 differing ways of calling a function from a component in Coldfusion. I've always called functions in one of 2 ways.
Method 1:
<cfset myComponent = createObject("component", "pathToMyComponent.componentGet")>
<cfset myVariable= myComponent.getKey (
data = someDSN,
key = myKey,
........)>
<cfinvoke component="pathToMyComponent.componentGet" method="getKey " returnvariable="myVariable">
<cfinvokeargument name="data" value="#someDSN#">
<cfinvokeargument name="key" value="#myKey#">
.......
</cfinvoke>
My question would be is there any overhead using Method 1 over Method 2. I assume there must be as you are instantiating an entire component, then only using 1 function. Method 2 would be my preferred way of calling a function but we would still have lots of calls made using Method 1. Just wondering what the advantages of one over the other would be and whats best from system memory/performance point of view?
Thanks
