> I was set here on a Saturday morning writing code for a website and I was > wondering what > is more efficient when working with setting and manipulating variable values. > > Which is more efficient? > > Doing it all in one call? > <cfscript> > Variables.myVar = Trim(Replace(SomeValue, "whatever", "something", "ALL")); > </cfscript> > > Seperating the functions? > <cfscript> > Variables.myVar = Replace(SomeValue, "whatever", "something", "ALL"); > Variables.myVar = Trim(Variables.myVar); > </cfscript> > > Seperating the functions with a assignment to a new variable? > <cfscript> > Variables.myVar = Replace(SomeValue, "whatever", "something", "ALL"); > Variables.myNewVar = Trim(Variables.myVar); > </cfscript>
Just thinking about this question cost you more time than you'll ever make up using one approach versus another. There is absolutely no difference between the first two, as the compiler sees them. The last one creates a new variable, so it has a minuscule additional cost, but it's insignificant. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333535 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

