Prev: Help with Data Bound Controls
Next: Structure ?
From: Tom Shelton on 26 Oct 2009 15:13 On 2009-10-26, G�ran Andersson <guffa(a)guffa.com> wrote: > Scott M. wrote: >> "Mr. Arnold" <Arnold(a)Arnold.com> wrote in message >> news:utnHehlVKHA.4704(a)TK2MSFTNGP06.phx.gbl... >> >>> It's get/set in VB as opposed to let/set in C#. >> >> C# uses get/set. >> >> -Scottt >> > > Besides, Let and Set is the same thing. VB6 uses Get and Let, but VB.NET > uses Get and Set. > VB6 uses GET/LET/SET -- Tom Shelton
From: Roshawn on 27 Oct 2009 07:30 Andrius B. wrote: > 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. > > Why not try a SortedList or a SortedDictionary? Just a thought!
From: Andrius B. on 27 Oct 2009 14:55 By the way, I thing the binary search using IComparer interface (witch is using for sorting such objects as Arraylist) is not the fastest one. Is there smth better? I mean, some kind of faster algorithm for sorting custom data types?
From: Tom Shelton on 27 Oct 2009 15:40 On 2009-10-27, Andrius B. <andriusbl(a)mail.lt> wrote: > By the way, I thing the binary search using IComparer interface (witch is > using for sorting such objects as Arraylist) is not the fastest one. Is > there > smth better? I mean, some kind of faster algorithm for sorting custom data > types? > > > The standard sort methods do not use Binary search - they use QuickSort. -- Tom Shelton
From: Göran Andersson on 28 Oct 2009 04:27
Andrius B. wrote: > By the way, I thing the binary search using IComparer interface (witch is > using for sorting such objects as Arraylist) is not the fastest one. Is > there > smth better? I mean, some kind of faster algorithm for sorting custom data > types? > The BinarySearch method is used for locating an item in an already sorted collection, and it's very fast. For a collection containing a million items you don't need more than 20 comparisons to find an item. You might get slightly better performance using a Dictionary, but that depends on how efficient the implementation of the hashing and comparison algorithms are. -- G�ran Andersson _____ http://www.guffa.com |