|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Using ## vs not using ##
Ok, i have another one. (In CF7)Michael Grant 09/01/10 12:27 P > Ok, i have another one. (In CF7)Dave Watts 09/01/10 12:31 P It makes me want to barf.Michael Grant 09/01/10 12:35 P >> <cfset errors["#varName#"]["string"] = errors["#varName#"]["string"] & "bitRick Root 09/02/10 08:32 A > <CFSET ERRORS[VARNAME]['STRING']Michael Grant 09/02/10 08:59 A evaluate() is almost always offensive :)Rick Root 09/02/10 09:05 A > It offends me, so I say he should do it. =)Dave Watts 09/02/10 09:11 A According to Adobe, yes.Eric Cobb 09/01/10 12:46 P Thanks Eric.Michael Grant 09/01/10 12:50 P just a quick test, please ignorePeter Boughton 09/02/10 11:07 A Note to all participants: This thread is not to be used for testingMichael Grant 09/02/10 11:19 A Ok, i have another one. (In CF7) Here's an example of code I'm running into: <cfset errors["#varName#"]["string"] = errors["#varName#"]["string"] & "bit to add here."/> I would normally write this as: <cfset errors[varName]["string"] = errors[varName]["string"] & "bit to add here."/> Other than the fact it's nicer to look at and just makes sense to do it my way, is there actually any speed increase doing it my way? ----- Excess quoted text cut - see Original Post for more ----- There will not be a significant speed increase, so don't worry about changing existing code unless you have time on your hands and it really offends you. 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. It makes me want to barf. However I don't really have the time for it. ----- Excess quoted text cut - see Original Post for more ----- >> <cfset errors["#varName#"]["string"] = errors["#varName#"]["string"] & "bit >> to add here."/> > > There will not be a significant speed increase, so don't worry about > changing existing code unless you have time on your hands and it > really offends you. It offends me, so I say he should do it. =) From a performance perspective, it might matter if there were a thousand of them on a page that was accessed a thousand times per second.... I would think that using ["#varname#"] would actually create a new string object in the java code where as [varname] would not.. but who knows. Still, the code IS offensive =) It would only be worse if it were like this... <CFSET ERRORS[VARNAME]['STRING'] = EVALUATE("ERRORS[""#VARNAME#""][""STRING""]") & "bit to add here."> Heh. (Yes, that does work) Rick > <CFSET ERRORS[VARNAME]['STRING'] > = EVALUATE("ERRORS[""#VARNAME#""][""STRING""]") & "bit to add here."> > /me vomits evaluate() is almost always offensive :) On Thu, Sep 2, 2010 at 8:58 AM, Michael Grant <mgrant@modus.bz> wrote: ----- Excess quoted text cut - see Original Post for more ----- > It offends me, so I say he should do it. =) Are you paying him? If so, he should definitely do it! I used to have the same opinion as you - I couldn't stand working with other people's code if it didn't meet my own standards. Now that I'm older, I think life's too short for that. Working code has an intrinsic value regardless of the ugliness of the source. If you have to work in that specific source repeatedly, it might be worth changing, but otherwise just hold your nose and move on. > From a performance perspective, it might matter if there were a > thousand of them on a page that was accessed a thousand times per > second.... In my prior measurements, conducted many years ago, it didn't make a significant measurable difference. > I would think that using ["#varname#"] would actually create a new > string object in the java code where as [varname] would not.. but who > knows. I would caution against making any assumptions about the underlying Java code from the way CF appears to work from the "outside". > Still, the code IS offensive =) I agree! > It would only be worse if it were like this... > > <CFSET ERRORS[VARNAME]['STRING'] = > EVALUATE("ERRORS[""#VARNAME#""][""STRING""]") & "bit to add here."> > > Heh. (Yes, that does work) That's pretty bad. I've seen worse, though. Don't get me started. 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 According to Adobe, yes. http://www.adobe.com/devnet/coldfusion/articles/coldfusion_performance_04.html Although, I'm sure it's probably negligible. All they really say is that the extra pound signs "will negatively affect performance". Thanks, Eric Cobb ECAR Technologies, LLC http://www.ecartech.com http://www.cfgears.com Michael Grant wrote: ----- Excess quoted text cut - see Original Post for more ----- just a quick test, please ignore (sorry for the noise) Note to all participants: This thread is not to be used for testing purposes. Thank you, Management On Thu, Sep 2, 2010 at 11:00 AM, Peter Boughton <boughtonp@gmail.com> wrote: > > just a quick test, please ignore > > (sorry for the noise)
|
February 08, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||