Judah, you got me wrong. For Railo there is no difference if searching #variables.foo# instead of #foo#. It is only a difference for Adobe CF. Here ACF checks whether there is a struct called variables in the variables scope and if not it will check the variables scope. If you only have "foo" it will check the variables scope instantly since there is no "." in the variable addressing and hence it's faster. In Railo variables.foo is identical to foo. This is one reason why we do not support dots in variable names like ACF if you use something like this: <cfset variables["susi.peter"] = 5> <cfoutput>#susi.peter#</cfoutput> <--- this works in ACF but not in Railo. Railo throws an error saying that there is no key named peter in the struct susi. ACF assumes first the same and in case of an error it checks the variables scope for a variable with the key "susi.peter". In Railo you have to write: <cfoutput>#variables["susi.peter"]#</cfoutput> Since we do not allow the first notation, when you have something like "variables.foo" Railo knows that it will check the variables scope at compile time. ACF does not!
Hope that clarifies things a little. Greetings from Switzerland Gert Franz Railo Technologies Professional Open Source skype: gert.franz g...@getrailo.com +41 76 5680 231 www.getrailo.com -----Ursprüngliche Nachricht----- Von: Judah McAuley [mailto:ju...@wiredotter.com] Gesendet: Donnerstag, 10. Dezember 2009 20:16 An: cf-talk Betreff: Re: scoping and speed Out of curiosity Gert, why would Railo be slower finding #variables.foo# than finding #foo# if variable cascading is on? Is it checking for the existence of a struct named variables before checking the actual scope or something? Judah On Thu, Dec 10, 2009 at 8:40 AM, Gert Franz <gert.fr...@railo.ch> wrote: > > Yes... that's true. If you even scope the variables from the variables scope > (EXCEPT in components, since they have their own variables scope) CF is > around 4 times slower than addressing a variable from there without the > prefix "variables". But this execution isn't very significant when your > website is quite slow. It is 4 times faster not to scope variables from the > variables scope, but in reality you won't notice that much improvement since > accessing variables in comparison to querying a database is really a matter > of order of magnitudes (So maybe "variables.whatever" executes in 12 nano > seconds, where as "whatever" executes in 3 nano seconds, whereas a query > will take 1ms which is 1000 nano seconds). > > In Railo you can enable a setting that actually forces you to scope your > variables from the various scopes. So for instance if you do something like > this: > <cfoutput>#id#</cfoutput> > and ID is in the URL scope Railo will complain that it doesn't know the > variable ID (if this setting is turned on) and throw an error. So you HAVE > TO write it like this: > <cfoutput>#url.id#</cfoutput> > Then Railo processes the page without error. > Once you have scoped all your variables the system will be somewhat faster. > > Just imagine it like this: > You are searching for a Peter (a variable) in a school (CF memory). You > enter every classroom (scope) and check whether a pupil named "Peter" is > sitting in it. If you find it, thats your variable. But if you know that > Peter is sitting in the classroom number 55 then you go directly there and > look for Peter. With the scope cascading disabled, Railo will not allow you > to look for a "Peter" in the school without the classroom number. > > Hope that helps a little. > > Greetings from Switzerland > Gert Fran ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329073 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4