PDA

View Full Version : ListStore line 412...



iljas
7 Jun 2009, 11:51 PM
Hi,
It is in "insert(List<M> items, int index, boolean supress)" method of the ListStore...

Maybe I miss something but "applySort(true)" method will be called on each iteration of "for loop", which in turn call Collections.sort() on items in the store...
So if you are adding 400 items to the store, sorting will be applied 400 times. Which clearly is performance hit... :-?



for (M m : items) {
if (isFiltered()) {
snapshot.add(m);
if(!isFiltered(m, filterProperty)) {
all.add(m);
}
} else {
all.add(m);
}
applySort(true);
int idx = indexOf(m);
registerModel(m);
if (!defer && !supressEvent) {
StoreEvent evt = createStoreEvent();
evt.models = Util.createList(m);
evt.index = idx;
fireEvent(Add, evt);
}
}