Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Fill items performance

stf obc
1 decade ago May 01, 2012 11:02am
Jean-François Lamy
1 decade ago May 01, 2012 11:45am
stf obc
1 decade ago May 01, 2012 12:02pm
stf obc
1 decade ago May 01, 2012 12:17pm
stf obc
1 decade ago May 01, 2012 3:18pm
Tobias Demuth
1 decade ago May 02, 2012 10:07am
Henri Sara
1 decade ago May 03, 2012 10:34am

stf obc: I get a performance of approx. 300 items per second, when filling the items by looping over my itemlist to the table or an IndexedContainer - which seems way to slow?
I am using addItem(idx) and then item.getItemProperty(<some>).SetValue(<myVal>)

Adding an item to an IndexedContainer that is already attached to a Table usually causes the table to be notified and to refresh itself, which might slow down things quite a bit. If you are not using a custom container, I would recommend detaching the container from the table before performing large bulk updates and then reattaching it after the updates. You could also subclass IndexedContainer and use some of the protected internal add item methods that do not perform any filtering etc. and then just trigger all those operations at the end - read the source of IndexedContainer if you plan to do this.

On the other hand, a custom container (inheriting e.g. AbstractInMemoryContainer) might be a cleaner and perhaps also simpler approach here.

stf obc
1 decade ago May 03, 2012 12:07pm