On Wednesday, Nov 13, 2002, at 10:36 US/Pacific, jon hall wrote: > Thank you very much for your reply, and I agree that cfc's are worth a > small performance loss. Is there anything that we could do to speed it > up? Like storing the cfc reference in an application variable or > similar?
My initial tests indicate that you can get a very small speed up by using a scope-qualified name (in any scope) and that server scope seems slightly faster than variables scope. But the differences are very, very minor. One thing you can do - if the method is really a 'static' method (i.e., does not use 'this' scope or the unnamed scope) and does not call other methods in the CFC (i.e., it's really just a standalone UDF and just happens to be inside a CFC) - is this hack: <cfset objAdd = createObject("component","add")/> <cfset localFunc = objAdd.add/> <cfloop index="i" from="1" to "5000"> <cfset rs = localFunc()/> <!--- instead of rs = objAdd.add() ---> </cfloop> Of course this is really just same as calling a UDF in the first place and I really wouldn't encourage this sort of hack... It works because component methods are really just items in 'this' scope and therefore can be accessed (and manipulated) by code outside a CFC instance. And because UDFs are just variables that contain a sort of reference to the actual function code. Sean A Corfield -- Director, Architecture Web Technology Group -- Macromedia, Inc. tel: (415) 252-2287 -- cell: (415) 717-8473 aim: seancorfield -- http://www.macromedia.com An Architect's View -- http://www.corfield.org/blog/ Introducing Macromedia Contribute. Web publishing for everyone. Learn more at http://www.macromedia.com/contribute ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com