Speaking of composition, i've been wondering lately if there is any appreciable performance difference if you create an object and hold it in the variables scope of it's parent, and simply reinitialize it each time you need to use it during the course of a request (assuming you would need it multiple times), or if you just create the object as many times as needed during a request and initialize each one individually. I've been assuming that it probably doesn't make any difference, because a getTickCount() test around a simple createObject statement almost always renders a 0 ms execution time - but it looks like i'm wrong.
I've also been wondering if it makes any difference if you pass a simple value into an object, like a boolean for instance, or if you pass in a complex value like an object cached in application scope with loads of data in it. My simple mind was prejudiced toward there being a difference, but again, looks like I was wrong. I set up a loop of 100 interations and tried the different scenarios. Creating and initializing each pass took 9 or 10 times longer on average than creating the object once and reinitializing it with every pass, even if the values passed in differed. But it took the same amount of time to pass a value of "true" into the object as it did to pass in a largish object with loads of data cached in it. After what i've been experimenting with the last few days, i'm relieved to really see that composition carries no penalty in this regard. And now i know a little bit more how to optimize my code. Bottom line seems to be if you're reusing a component over the course of a request, create once and reinitialize. Now lemme try and get that worked in where it counts. ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
