On Friday, Jul 25, 2003, at 11:21 US/Pacific, cf_nut wrote:
Okay. Can you supply some specifics about your criteria for 'heavy' ?

Not really. It all depends on your application and how performant you need it to be.


I presume that by 'construction', we mean any overheads to using the
object, such as what's normally referred to as the 'constructor'
code in addition to any other explicitly invoked functions.

I mean the overhead involved in creating and initializing the instance, prior to actually calling a method. That overhead includes:
- allocating memory & initializing a bunch of Java objects
- executing any pseudo-constructor code (between cfcomponent and cffunction)
- under some circumstances (like the first time you create an instance since the source code changed) there are a number of other entities created as part of the class loading and initialization mechanism


At the very least, constructing an instance - and this includes using cfinvoke with a component name rather than a component instance - will 'cost':
fixed object creation
+ pseudo-constructor code


500 lines in a CFC too big ?

Irrelevant. You can have CFCs with 1,000s of lines that are still lightning fast to create.


10 functions ?

I'm still not 100% sure of the impact the number of functions has on creating an object. My initial tests led me to believe there was a linear overhead but that doesn't match my understanding of how the CFML compiler works. I need to run more tests. I'd expect inheritance to have more of an impact.


'Constructor' code that
runs longer than (I don't know) 50 ms ?

See above - pseudo-constructor code is definitely a factor in object creation time.


The real yard-stick is how many times you create a stateless CFC instance. If you create five instances of the same stateless CFC on every request, it doesn't match how quick it is to create, it will definitely be faster to create one instance and reuse it. In fact, if every single request creates an instance of the same stateless CFC, you'll save time by creating one instance and caching it (in application scope) and reusing it in each request.

You can't perform that optimization on stateful CFCs because they have their own data that is different between each instance. Cloning a stateful CFC has at least the same overhead as creating an instance in the first place (usually more since you end up copying in the instance data) and what you're trying to optimize away here is the creation time.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.


CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to