View Full Version : Faster way to empty a list
DanKirkd
06-20-2005, 05:04 PM
We often have to reload a list with new contents. When we do so, we first remove the items that are currently in the list. When the list is long, this takes far too long to do one item at a time.
Is there a quick way (in processing time) to simply completely empty a list of its listitems?
Dan
DanKirkd
06-21-2005, 12:21 PM
I should add that I've tried doing a destroy() on the list, but it would appear that a destroy() takes just as long, as if to destroy the list, it is destroying each of the listitems one by one.
I've further tried destroy(false), but that changes nothing - it takes just as long.
Dan
DanKirkd
06-22-2005, 06:05 PM
I spent more time on this problem and I'm getting nowhere with it. This is a HUGE PROBLEM! It literally takes minutes to destroy or empty a list of any significant size. A list of only 200 rows takes as much as 50 seconds to destroy. That's unacceptable.
We've tried nulling out the list and replacing it with a new list created at runtime, but that just creates a memory leak problem.
Doesn't anyone else have this type of problem? It would amaze me if nobody else does.
Dan
ilanToren
06-23-2005, 05:10 AM
If the data for the list was delivered via a dataset then you could update the list by the request() method. I'm sure it would take some time to refresh still, but perhaps less.
And now for something completely different....
I think that this idea has less merit but it goes something like this. Using the <state> tag you can switch in and out the datagrid in question. Each state-grid has it's own dataset. When you need to switch data first load the new dataset and then switch out the other datagrid and replace. The obvious downside is that you will have an overlap when both datasets are populated. It is sort of like implementing paging. Does this sound worthwhile at all? Remember Roseana Ana Dana from SNL (oh, never mind)......
DanKirkd
06-23-2005, 09:53 AM
Originally posted by ilanToren
If the data for the list was delivered via a dataset then you could update the list by the request() method. I'm sure it would take some time to refresh still, but perhaps less.
And now for something completely different....
I think that this idea has less merit but it goes something like this. Using the <state> tag you can switch in and out the datagrid in question. Each state-grid has it's own dataset. When you need to switch data first load the new dataset and then switch out the other datagrid and replace. The obvious downside is that you will have an overlap when both datasets are populated. It is sort of like implementing paging. Does this sound worthwhile at all? Remember Roseana Ana Dana from SNL (oh, never mind)......
I'm not sure the swapping in and out of the lists wouldn't eliminate the delay that would occur when the remove of the listitems is in progress. Just because the list isn't visible, I'd be surprised it would make any difference.
But at this point I'm ready to try anything.
Thanks for the suggestions though. Much appreciated.
Dan
DanKirkd
06-23-2005, 02:50 PM
Well, I tried using a state approach and that doesn't help. In fact, each swap of the state simply eats up memory without freeing any up.
Any other suggestions?
Dan
DanKirkd
07-18-2005, 08:25 AM
Hello - I've been away for a couple of weeks but in that time no one has responded on this issue, so I'm asking again with the hope that indeed, someone has a solution.
Thanks,
Dan
ilanToren
07-19-2005, 12:23 AM
There was a discussion on http://www.laszlosystems.com/developers/community/forums/showthread.php?threadid=1074&referrerid=8799
and I have yet to apply it to my project. I think that it might have the answer for you though, but until I get it working....
Hope your vacation was pleasant.
DanKirkd
07-20-2005, 11:09 AM
Originally posted by ilanToren
There was a discussion on http://www.laszlosystems.com/developers/community/forums/showthread.php?threadid=1074&referrerid=8799
and I have yet to apply it to my project. I think that it might have the answer for you though, but until I get it working....
Hope your vacation was pleasant.
Yes it was, thanks :)
We'll take a look at what you've pointed us to, but I'm not sure lazy loading solves our problem given what actually takes so long is the removal of the existing list items and we can't lazy unload without having an odd length scroll bar displaying.
Dan
lwz7512
07-20-2005, 10:05 PM
if you use addItem() and removeItemAt(),for a long list item, it can be slow.
but if you use data binding, and change the data source by adding a property of "pooling", it will improve a lot.
more details to see:Chapter 35. Performance Monitoring and Tuning,Part VII. Performance Monitoring and Tuning,4. Optimizing runtime performance with pooling
hope this helpful to you.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.