PDA

View Full Version : faster loop ? beta 1 to rc2 change



dedoz
9 Apr 2012, 4:33 AM
theres a change from 4.1beta1 to 4.1rc2 and changes the way that iterates over the records on a store.
note that theres nothing else (vars) that affect this code

4.1 BETA1


if (inverse) {
store.data.each(function(associatedRecord){
associatedRecord[inverse.instanceName] = record;
});
}


4.1 RC2


if (inverse) {
items = store.data.items;
iLen = items.length;

for (i = 0; i < iLen; i++) {
items[i][inverse.instanceName] = record;
}
}

they are pretty much doing the same thing just the later uses javascript FOR instead of ext each

so this is the way to iterate over store records and should avoid using ext each ? or theres another difference in this source code ?

scottmartin
9 Apr 2012, 6:38 AM
I would suspect it is a speed issue. Each is a tad slower ;)

Regards,
Scott.