How to optimize Javascript lookups?
<p>According to Javascript's major implementations, the lookup for variables and functions starts at the spot and traversing upwards until the global objects.</p>

<p>Now lets say you're building larger OOP based frameworks and you need to call safety checks all over the place, then it doesnt seem right to call those things that way : "xapp.utils.isValidString(var). The same applies to constants, enumerations and flags which take place everywhere usally. </p>

<p>I am not quite sure whether this has impacts on the answer but we're doing all in Dojo and we are pretty aware about its lang.mixin method. </p>

<p>However, the idea is to mixin an obvious and minimal set of funtions and objects into the target objects local scope by using the constructor or prototype. Would you consider this to be a legal way ? </p>

<p>Then what about caching and reusing those prepared objects ? Which kind of buffer you would choose ? To me it looks rather like an ring buffer. </p>

<p>I am still learning JS optimization and I would be happy about your thoughts !</p>

<p>For your reference, here some common tips about scope managment explained by a guru : <a href="http://googlecode.blogspot.com.es/2009/06/nicholas-c-zakas-speed-up-your.html" rel="nofollow">http://googlecode.blogspot.com.es/2009/06/nicholas-c-zakas-speed-up-your.html</a> </p>

<p>Update : We need to focus only on modern desktop and mobile browsers, leaving IE totally out !
Also, we're familiar with Dojo's build chain, enabling conditional compiling per platform (If that matters).</p>
