By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,032 Members | 1,141 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,032 IT Pros & Developers. It's quick & easy.

Speed issues with filling a list view

P: n/a
I was wondering how you guys would handle filling a list view with something
like 10,000 items which each have 10 sub items on them... there has to be
major speed issues with that right? Yet, applications like outlook and such
can retrieve and display tens of thousands of emails with virtually no
performance hit at all... how would we go about getting a .NET listview to
get similar performance? when I try to do what I said above, it takes about
15 seconds or more to fill it with that much information and that is just
random test data... not real life from a database data either
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Welcome to the world of threading!

Load the visible page, then continue to load the rest in another thread.

There is a good example in chapter 10 of:
http://www.apress.com/book/bookDisplay.html?bID=173

The source code is available for download.

"Brian Henry" <no****@nospam.com> wrote in message
news:OM**************@TK2MSFTNGP11.phx.gbl...
I was wondering how you guys would handle filling a list view with
something like 10,000 items which each have 10 sub items on them... there
has to be major speed issues with that right? Yet, applications like
outlook and such can retrieve and display tens of thousands of emails with
virtually no performance hit at all... how would we go about getting a .NET
listview to get similar performance? when I try to do what I said above, it
takes about 15 seconds or more to fill it with that much information and
that is just random test data... not real life from a database data either

Nov 21 '05 #2

P: n/a
I do not think that it is a listview that is used; rather, I think that the
control is a datagrid. I also think that only that which is visible plus a
few more are actually loaded on initial load. The rest of the data is
loaded on demand to match the scrollbar. Counts, and pointers are the only
thing loaded on initial load.

"Brian Henry" <no****@nospam.com> wrote in message
news:OM**************@TK2MSFTNGP11.phx.gbl...
I was wondering how you guys would handle filling a list view with
something like 10,000 items which each have 10 sub items on them... there
has to be major speed issues with that right? Yet, applications like
outlook and such can retrieve and display tens of thousands of emails with
virtually no performance hit at all... how would we go about getting a .NET
listview to get similar performance? when I try to do what I said above, it
takes about 15 seconds or more to fill it with that much information and
that is just random test data... not real life from a database data either

Nov 21 '05 #3

P: n/a
The best performance I have gotten from a ListView is via
ListView.Items.AddRange(x)
where x is an array of ListViewItems. With the data volume you have,
I think the way to go is a worker thread that creates an array of
ListViewItems, loads data into the array, and from time to time calls
AddRange and reinitializes. Be aware of the need to execute AddRange on gui
thread rather than on the worker thread.

Nov 21 '05 #4

P: n/a
"Brian Henry" <no****@nospam.com> schrieb:
I was wondering how you guys would handle filling a list view with
something like 10,000 items which each have 10 sub items on them... there
has to be major speed issues with that right? Yet, applications like
outlook and such can retrieve and display tens of thousands of emails with
virtually no performance hit at all... how would we go about getting a .NET
listview to get similar performance?


You may want to use a virtual listview:

<URL:http://www.ilypsys-systems.co.uk/ils1controls.zip>

Note that .NET 2.0's listview control will support a virtual mode
('VirtualMode' property) which allows to display millions of items
blindingly fast.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5

P: n/a
wow you are right, doing an addrange increased our performance by a lot of
time. Before it took 4530 milliseconds to fill, now it only takes 635
milliseconds

"AMercer" <AM*****@discussions.microsoft.com> wrote in message
news:E3**********************************@microsof t.com...
The best performance I have gotten from a ListView is via
ListView.Items.AddRange(x)
where x is an array of ListViewItems. With the data volume you have,
I think the way to go is a worker thread that creates an array of
ListViewItems, loads data into the array, and from time to time calls
AddRange and reinitializes. Be aware of the need to execute AddRange on
gui
thread rather than on the worker thread.

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.