Huzzah for <cfinterface> ;-p
Yeah yeah I know...CF is not Java... -----Original Message----- From: Brian Kotek [mailto:[EMAIL PROTECTED] Sent: 07 June 2007 15:36 To: CF-Talk Subject: Re: CFC Typeof() The reason I thought it would be slower is that I recall someone trying to write a way of allowing interfaces in CFCs that relied on calls to getMetaData() to look up method signatures and such, and I remember that it was very slow. I wrote a simple test to check it out. While the results aren't air tight, you're right the initial call to getMetaData for a good-sized CFC was almost 10 times slower than a try/catch block on the same CFC to catch a nonexistent method call. However, subsequent calls (using a loop) were almost exactly the same. This was on CFMX8 which is what I have running at the moment. So it looks like either one is probably just fine. As always, thanks for the clarification, Barney. Brian On 6/7/07, Barney Boisvert <[EMAIL PROTECTED]> wrote: > > I'm inclined to disagree. getMetaData is cached, so while the first > invocation may require some additional overhead, subsequent calls just > return the already-existing object straight away, so they're > blindingly fast. This also means that you can cache your own metadata > in the metadata struct if you care to. Like, for example, the results > of instanceOf calls, so repeated calls with the same type don't have > to scan the tree. > > Exception handling is typically an expensive operation, because > performance is less important that assisting in recovery and/or > debugging (if it's checked or unchecked). Java has this > characteristic, and since CF uses the Java exception handling > mechanism (plus a wrapper), CF has the same issues/benefits. > > cheers, > barneyb > > On 6/6/07, Brian Kotek <[EMAIL PROTECTED]> wrote: > > Actually I'm quite sure that a try/catch block would be much faster than > > calling getMetaData(), especially for CFCs with more than 1 or 2 levels > of > > inheritance. > > > > -- > Barney Boisvert > [EMAIL PROTECTED] > http://www.barneyb.com/ > > Got Gmail? I have 100 invites. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & Flex 2 Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280381 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4