Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 07-05-2000, 03:42 PM   #1
Member (7 bit)
 
Join Date: Nov 1999
Posts: 65
Question

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
Cymbeline is offline   Reply With Quote
Old 07-05-2000, 04:08 PM   #2
Member (12 bit)
 
Paul Victorey's Avatar
 
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
Post

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.
Paul Victorey is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:01 AM.
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0