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

Reply via email to