Jagged arrays question

J

James dean

I have created algorithms in C# unsafe code and have fixed the arrays in
memory for optimum performance. I use multidimensional arrays rather
than jagged arrays. The algorithms i use usually read a bitmap file
sequentially so no random accessing different parts of the array. I know
in microsoft site it says to use jagged arrays but in this case with
reading a sequential file the performance difference will not be as good
as a multi-dimensional array
 
J

Jon Skeet [C# MVP]

I have created algorithms in C# unsafe code and have fixed the arrays in
memory for optimum performance. I use multidimensional arrays rather
than jagged arrays. The algorithms i use usually read a bitmap file
sequentially so no random accessing different parts of the array. I know
in microsoft site it says to use jagged arrays but in this case with
reading a sequential file the performance difference will not be as good
as a multi-dimensional array

Possibly - you'd have to try it.

Do you have an actual question?
 
J

James dean

The question is...if i am always reading from an array sequentially and
assigning values will jagged arrays still outperform multidimensional
arrays?.

Thanks in advance
 
J

Jon Skeet [C# MVP]

The question is...if i am always reading from an array sequentially and
assigning values will jagged arrays still outperform multidimensional
arrays?.

Well, the easiest thing would be just to try it. I suspect it still
would be faster, yes. However, whether it would be *significantly*
faster is a whole different question, and that depends on your app. It
shouldn't be too hard to try it both ways and time it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top