Click here to Skip to main content
15,886,026 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dynamic Arrays Pin
Bassam Abdul-Baki30-Aug-10 4:24
professionalBassam Abdul-Baki30-Aug-10 4:24 
GeneralRe: Dynamic Arrays Pin
harold aptroot30-Aug-10 4:30
harold aptroot30-Aug-10 4:30 
GeneralRe: Dynamic Arrays Pin
Bassam Abdul-Baki30-Aug-10 5:03
professionalBassam Abdul-Baki30-Aug-10 5:03 
GeneralRe: Dynamic Arrays Pin
harold aptroot30-Aug-10 5:05
harold aptroot30-Aug-10 5:05 
GeneralRe: Dynamic Arrays Pin
Bassam Abdul-Baki30-Aug-10 5:19
professionalBassam Abdul-Baki30-Aug-10 5:19 
GeneralRe: Dynamic Arrays Pin
harold aptroot30-Aug-10 5:25
harold aptroot30-Aug-10 5:25 
GeneralRe: Dynamic Arrays Pin
JasonPSage31-Aug-10 5:05
JasonPSage31-Aug-10 5:05 
GeneralSlimList Pin
AspDotNetDev31-Aug-10 5:08
protectorAspDotNetDev31-Aug-10 5:08 
I created a data structure, SlimList, and wrote an article about it. Read that.

A SlimList is like a .Net List, except it avoids copying any elements on the resize. So, a .Net List will double the size of the underlying array then copy the items over from the old array to the new array that is twice the size. A SlimList will just create an additional array that is the same size as the existing arrays combined, but will not copy any elements over. It does this by creating a "major" array to hold all the references to the "minor" arrays. All operations on on par with List with respect to big-O notation (e.g., an index operation takes O(1) time). However, as it is currently implemented, SlimList is a lot slower than List (about 600x slower in some cases). However, with a little assembly code and some other modifications (that I've outlined in the article), it could be made to be about 2x slower than List. Probably not worth it, which is why I didn't implement the optimizations myself, but it's an interesting data structure that does overcome the array copy issue that exists with current implementations of List.

So I'd say look at SlimList to see what route you could take, but then use List because that's going to be the most efficient route if speed is important.

Also, if you are going to create a very large list (as you indicated in one of your replies), then I recommend creating lists of lists, rather than a single list. The reason is that memory fragmentation and other limits may prevent you from creating a single contiguous chunk of memory above a certain size (say, 256MB, a limit I've run into before due to fragmentation). That also helps to remedy the array copy problem. The sublists can always be created with a known capacity(e.g., 10,000,000 elements). Then it would only be the "major" list that would grow, and it would not grow very often. You would then only require two index operations to access a BigInteger within your list of lists and you wouldn't hit the memory issues.

GeneralRe: SlimList Pin
Bassam Abdul-Baki31-Aug-10 5:25
professionalBassam Abdul-Baki31-Aug-10 5:25 
GeneralRe: SlimList Pin
Bassam Abdul-Baki31-Aug-10 5:30
professionalBassam Abdul-Baki31-Aug-10 5:30 
GeneralRe: SlimList Pin
Bassam Abdul-Baki2-Sep-10 14:48
professionalBassam Abdul-Baki2-Sep-10 14:48 
GeneralRe: SlimList Pin
AspDotNetDev2-Sep-10 20:10
protectorAspDotNetDev2-Sep-10 20:10 
GeneralRe: SlimList Pin
Bassam Abdul-Baki4-Sep-10 10:47
professionalBassam Abdul-Baki4-Sep-10 10:47 
QuestionChange/Read Language used for Non-Unicode Programs Pin
jojoba201130-Aug-10 3:14
jojoba201130-Aug-10 3:14 
AnswerRe: Change/Read Language used for Non-Unicode Programs Pin
Dave Kreskowiak30-Aug-10 3:58
mveDave Kreskowiak30-Aug-10 3:58 
QuestionRe: Change/Read Language used for Non-Unicode Programs Pin
jojoba201130-Aug-10 4:08
jojoba201130-Aug-10 4:08 
AnswerRe: Change/Read Language used for Non-Unicode Programs Pin
Dave Kreskowiak30-Aug-10 11:56
mveDave Kreskowiak30-Aug-10 11:56 
Questionabout text editor. only text editor, not server or .... Pin
Fred 3429-Aug-10 23:11
Fred 3429-Aug-10 23:11 
GeneralRe: about text editor. only text editor, not server or .... Pin
Bigdeak29-Aug-10 23:35
Bigdeak29-Aug-10 23:35 
GeneralRe: about text editor. only text editor, not server or .... Pin
Fred 3431-Aug-10 2:34
Fred 3431-Aug-10 2:34 
AnswerRepost PinPopular
Pete O'Hanlon30-Aug-10 0:35
mvePete O'Hanlon30-Aug-10 0:35 
AnswerRe: about text editor. only text editor, not server or .... [modified] Pin
PIEBALDconsult30-Aug-10 3:16
mvePIEBALDconsult30-Aug-10 3:16 
AnswerRe: about text editor. only text editor, not server or .... Pin
Eddy Vluggen30-Aug-10 8:54
professionalEddy Vluggen30-Aug-10 8:54 
QuestionParallel and Thread running some mission ( code attached ) Pin
Yanshof29-Aug-10 22:49
Yanshof29-Aug-10 22:49 
AnswerMessage Closed Pin
29-Aug-10 23:26
stancrm29-Aug-10 23:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.