Re: scoping and speed

2009-12-10 Thread Charlie Griefer

In theory, yes, as ColdFusion will have to hunt through the various scopes
to find the exact variable that you're referencing.

Whether it's noticeable or not.. hard to say.

From the CF8 docs (
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Variables_32.html
):

Because ColdFusion must search for variables when you do not specify the
scope, you can improve performance by specifying the scope for all
variables.

I do actually recall hearing that on Railo, it was faster to -not- scope
local variables.  Not sure if that still holds true or not.

On Thu, Dec 10, 2009 at 7:13 AM, Chad Gray cg...@careyweb.com wrote:


 If you don't scope your local variables does the page run slower?

 IE. #variables.foo# vs. #foo#


 

~|
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:329047
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: scoping and speed

2009-12-10 Thread brad

Funny thing is, even when I have specified scope for all my variables,
I've still seen ColdFusion stack traces hunting around for scopes. 
However, please note this was a very intense script trying to calculate
all prime numbers between 0 and 10,000,000.  For the other 99.% of
ColdFusion code out there, do what creates the most manageable,
self-documenting code.  The performance results will most likely be
negligible.

~Brad

 Original Message 
Subject: Re: scoping and speed
From: Charlie Griefer charlie.grie...@gmail.com
Date: Thu, December 10, 2009 9:59 am
To: cf-talk cf-talk@houseoffusion.com



Because ColdFusion must search for variables when you do not specify
the
scope, you can improve performance by specifying the scope for all
variables.



~|
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:329054
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: scoping and speed

2009-12-10 Thread Judah McAuley

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, that’s 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:329071
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: scoping and speed

2009-12-10 Thread Eric Cobb

According to Adobe, Yes.

http://www.adobe.com/devnet/coldfusion/articles/coldfusion_performance_04.html

Thanks,

Eric Cobb
http://www.cfgears.com



Chad Gray wrote:
 If you don't scope your local variables does the page run slower?

 IE. #variables.foo# vs. #foo#


 

~|
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:329072
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: scoping and speed

2009-12-10 Thread Charlie Griefer

Actually I think that was my bad.  I had mentioned that I heard #foo#
evaluates faster than #variables.foo# on Railo.  Guess I heard (or
remembered) incorrectly :)

Sorry 'bout that.

On Thu, Dec 10, 2009 at 1:11 PM, Gert Franz gert.fr...@railo.ch wrote:


 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, that’s 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:329075
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4