A
Andrius B.
Hi all.
I used Hashtable to store data loaded from Access (the db can contain from
1000 till 100000 records), and that worked very well, because of fast data
retrieving from Hashtable using key.
The main problem with Hashtable is sorting. I have to convert all the
Hashtable to array list or smth, sort it with the help of ICompairer
interface, and then converting back to hashtable. That takes much time.
Now I am trying to modify the app code and started to use Datatable objects
instead of Hashtable. Datatable has a much faster sorting mechanism, and
that is very important for me, because I have to display the items from the
db in Listview - not all of them, just some (up to 50), but the items must
be ordered by certain key, t.i. the user should have possibility ti order
the items in the way he wishes. That's why fast sorting is neccessary.
ListView is in Virtual mode.
But on the other hand, datatable is not the one I am looking for. The item
retrieving from datatable (using datatable.rows.find (by key) is much slower
than getting items from hashtable. When for sorting and displaying, it is
not very bad, because, as I have said, I need at a moment dislpay only up to
50 items in Listview. But also my program has to make some calculations and
analysis with the data, so when it tries to retrieve data from datatable,
the speed of analyse decreases very markebly, in compairing to hashtable.
So, what could I do, if want to have fast sorting and also fast data
retrieving in my app? Storing the data both in datatable and in hashtable
could be a solution, but it consumes to much memory. Is there a class or
smth, that could provide this? Or should I try to write my own class
implementing many interfaces (for sorting etc.)?
I use VB.Net 2005.
Thanks for any help.
I used Hashtable to store data loaded from Access (the db can contain from
1000 till 100000 records), and that worked very well, because of fast data
retrieving from Hashtable using key.
The main problem with Hashtable is sorting. I have to convert all the
Hashtable to array list or smth, sort it with the help of ICompairer
interface, and then converting back to hashtable. That takes much time.
Now I am trying to modify the app code and started to use Datatable objects
instead of Hashtable. Datatable has a much faster sorting mechanism, and
that is very important for me, because I have to display the items from the
db in Listview - not all of them, just some (up to 50), but the items must
be ordered by certain key, t.i. the user should have possibility ti order
the items in the way he wishes. That's why fast sorting is neccessary.
ListView is in Virtual mode.
But on the other hand, datatable is not the one I am looking for. The item
retrieving from datatable (using datatable.rows.find (by key) is much slower
than getting items from hashtable. When for sorting and displaying, it is
not very bad, because, as I have said, I need at a moment dislpay only up to
50 items in Listview. But also my program has to make some calculations and
analysis with the data, so when it tries to retrieve data from datatable,
the speed of analyse decreases very markebly, in compairing to hashtable.
So, what could I do, if want to have fast sorting and also fast data
retrieving in my app? Storing the data both in datatable and in hashtable
could be a solution, but it consumes to much memory. Is there a class or
smth, that could provide this? Or should I try to write my own class
implementing many interfaces (for sorting etc.)?
I use VB.Net 2005.
Thanks for any help.