|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (7 bit)
Join Date: Nov 1999
Posts: 65
|
This may be a stupid question, but here it is:
Which array declaration will be faster to access? 1. int Matrix1[5][12]; int Matrix2[5][12]; int Matrix3[5][12]; 2. int Matrix[3][5][12]; Cymbeline |
|
|
|
|
|
#2 |
|
Member (12 bit)
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
|
Well, option #2 is easier to program with, as you will have only a single array.
As to speed, I really couldn't tell you. It may vary depending on compiler even. Why not create code to read, one at a time, every element of the array(s) using both styles, do this something like 1000 times (it would be too quick to really measure otherwise) and have the program take a beginning and end time and subtract? I don't think it's going to be much different though. I wouldn't know how to get this info except by testing it. ------------------ Paul M. Victorey ------------------ I am not responsible for any problems that may arise as a result of following my advice. This includes, but is not limited to, computer failure, loss of data, nuclear war, famine, boils, no clean laundry, your daughter running off with a biker gang, or armageddon. Take my advice at your own risk. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|