I use a config object to store configuration information. So something like this example:
var value = myObject.Get('name');
The actual config is stored in an array – ie config['name'] = value
There are a lot of calls to the Get() function – over 25,000. How significant would the difference be if that array was accessed directly instead of via he Get() call?
Also – in an animation that 25,000 could be done 60 times per second (!)
The direct access should be faster, but you should do some tests, because the code performance is often influenced by the js engine.
For example, it’s about 50% faster to access an object’s key through the dot synthax (
obj.key) than the asociative array like one (obj["key"]) in chrome, while in firefox it’s the other way around.I recommend you don’t do micro-optimisations before you end your project and only after you do some testing/research.