I botched that last email. Dot performance can be an issue in for loops and functions that are repeatedly. The more dots you add the worse. Caching values is a great way to avoid the performance hit because even though a dot notation identifier might appear more than once in a block of code it is evaluated each time it is crossed.
I personally do not cache all over the place. However when I am writing initialization code, loop code, or functions that are called heavily, I make sure to avoid deep dots. -Andrew Martinez -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martinez, Andrew Sent: Tuesday, May 23, 2006 9:02 AM To: [email protected] Subject: RE: [Rails-spinoffs] Minimizing dots for accessing properties It is a performance hit. Dot notation is a performance hit and you should avoid it in loops and volatile functions (things that are run very often). However, you should scrutinize the usage of it since it will not help you all that much everywhere. -Andrew Martinez -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Maninder, Singh Sent: Tuesday, May 23, 2006 3:41 AM To: [email protected] Subject: RE: [Rails-spinoffs] Minimizing dots for accessing properties Would it be better if I cached the object? eg: var E = Many.util.Error; E.test(); E.test2(); E.test3(); Instead of Mandy.util.Error.test(); Mandy.util.Error.test1(); Mandy.util.Error.test2(); Thanks, Mandy. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Maninder, Singh Sent: Tuesday, May 23, 2006 12:59 PM To: [email protected] Subject: [Rails-spinoffs] Minimizing dots for accessing properties This is more of a javascript question. I would like to know if there is a performance hit if variable/properties are accessed with many dots? Eg: Calling a method test() like Mandy.util.Error.test(); Vs Error.test(); Thanks in advance, Mandy. _______________________________________________ Rails-spinoffs mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
