I'd like to elaborate this question a bit. The question was, if the access time of the object is constant, i.e. independent on amount of attributes. The answer was, that it indeed is constant.
I've made a quick test on jsFiddle which however (at least for Chrome) showed, that there is quite significant difference (~three-fold) between access time of object with 10 attributes and object with 100k attributes.
So my first question is. Is the access time really constant and the difference is given by imprecision of the measurement due to memory management or something related to initialization and not the accessing?
Then thg435 created a benchmark, in which it is easy to see the differences between access times of big and small object in various browsers, so e.g. IE and Safari shows no difference between big and small objects (both are basically very slow), while Firefox and even more Opera and Chrome show huge difference in access times. But also it shows incredible differences between speeds of the browsers (e.g. IE ~50-100 times slower than Firefox or Chrome).
My second question is then - can these results be trusted? Or maybe some optimization (which won't make this big difference in real JS codes) kicks in degrading the results significantly? How to make a benchmark of accessing variables, which is fair? I've made second benchmark in order to avoid the optimization by not only accessing the variable, but also using its value (at the cost of measuring also numeric operations), which reduces otherwise insane speed of Chrome and Opera, but still the speed of IE is like 100x slower. I kind of know, that IE is slow. But being this much slower sounds suspicious to me.
Updated: I've added a third benchmark which aims to address the complexity better.
Footnote: it doesn't allow me post the question with the link to jsfiddle without the code, so here is the testing code.
function go(amount) {
var object1 = {};
for (var i = 0; i < amount; i++) {
object1['id' + i] = i;
}
var start = new Date().getTime();
var j = 0;
for (var i = 0; i < 100000000; i++) {
j += object1['id3'];
}
var end = new Date().getTime();
console.log(j);
document.getElementById('result').innerHTML = end - start;
}