Speed Problem ... Performance HELP PLEASE...

  • Thread starter Thread starter João Santa Bárbara
  • Start date Start date
J

João Santa Bárbara

Hi all
i have a datatable with 2500 records, and i want to fill a listview,
my problem is that it take too much time to load them all. is anytihing i
could do to
improve my performançe..... ????
it take about 45 seconds with 2500, i need to put at least 10000 in few
seconds ... :(

See my code below perhaps you can help ..

thks
JSB

Me.lvwAvailable.Sorting = SortOrder.None
Dim iNum As IEnumerator = Me.DataSet.Contacts.Rows.GetEnumerator

While (iNum.MoveNext)
itm = Me.lvwAvailable.Items.Add(iNum.Current("ContactID"))
itm.SubItems.Add(IIf(iNum.Current("ContactName") Is
System.DBNull.Value, "", iNum.Current"ContactName")))
Application.DoEvents()
End While
 
Hi

What are you populating your Datase with? Maybe you can skip the dataset
Step and populate your listview stright from a DataReader.

Gary
 
thks william
it works better, but i need more performance... :(

thks anyway
JSB
 
sorry but i need the Dataset .. :(

ths
JSB

Gary van der Merwe said:
Hi

What are you populating your Datase with? Maybe you can skip the dataset
Step and populate your listview stright from a DataReader.

Gary
 
Joao:

There's only so much you can do with a listview and that many records.
Faster processors and more Ram can help too, but that's probably not always
an option. There are some constraints that you are forced to deal with, and
10000 records in a Listview isn't going to be blazing fast. just look at
Windows Explorer when you have 2000 files in a directory....Slooowwww.

I'd really consider taking another look at my UI strategy if speed is that
important and you have to use a Listview. When the user scrolls, add
another 100 or 200 records. This will occur much faster and the user isn't
really needed 10,000 records in one place at one time. If the user scrolls
only once or not at all, the other records dont' get loaded (this way they
aren't penalized with load times for data they don't need). If they keep
scrolling, then they'll get only what they need, until they have
everything...then scrolling will be relatively fast.

Others may disagree, but I'd seriously reconsider my strategy there if I
have to use a Listview and have to have 10,000 records...

You know, you can do a lot with grids and set their bindings and maniuplate
their styles..they are probably architecturally better suited for this type
of heavy lifting.

HTH,

Bill
 
Hi João,

I'd remove that Application.DoEvents pronto. That will slow it down a lot. If you insist on having it there, have a
counter which only calls it once every few hundred items.

I'd give Bill's idea a good think about, too. Users don't like waiting for 10,000 records just to examine a few!! They
do appreciate good searching and filtering, though - it beats scrolling any day.

Regards,
Fergus
 
Back
Top