Any tips/hints regarding moving through an array.
Author |
Message |
Stuart Dougla #1 / 4
|
 Any tips/hints regarding moving through an array.
Hi, I've got a program that loops through X/Y co-ords, does some calculations, stores the results in a tiny array (16 elements), then finds the largest value in the tiny array, stores this info to a array representing the X/Y co-ords, then moves onto the next co-ord. At the moment it take some time to process and I would love to speed it up. Are there any pointers I should be aware off? i.e. what slows down loops, what speeds up loops. I'm also using a loop to find the largest value in the small 16 element array, is there a more efficient method? Thanks for any advice. Stuart
|
Sat, 31 Jan 2004 20:50:29 GMT |
|
 |
Michael William #2 / 4
|
 Any tips/hints regarding moving through an array.
Post your code. Mike
Quote: > Hi, > I've got a program that loops through X/Y co-ords, does some calculations, > stores the results in a tiny array (16 elements), then finds the largest > value in the tiny array, stores this info to a array representing the X/Y > co-ords, then moves onto the next co-ord. > At the moment it take some time to process and I would love to speed it up. > Are there any pointers I should be aware off? > i.e. what slows down loops, what speeds up loops. I'm also using a loop to > find the largest value in the small 16 element array, is there a more > efficient method? > Thanks for any advice. > Stuart
|
Sat, 31 Jan 2004 21:00:46 GMT |
|
 |
Lee Wein #3 / 4
|
 Any tips/hints regarding moving through an array.
Your code is populating the array, then looping thru it to find the highest value? Without seeing your code, one idea is to keep track of the highest value you've added so far when you ADD the values to the array. That way you won't have to loop thru it after you finish populating it. Lee Weiner lee DOT weiner AT home DOT com http://members.home.net/lee.weiner
Quote:
>Hi, >I've got a program that loops through X/Y co-ords, does some calculations, >stores the results in a tiny array (16 elements), then finds the largest >value in the tiny array, stores this info to a array representing the X/Y >co-ords, then moves onto the next co-ord. >At the moment it take some time to process and I would love to speed it up. >Are there any pointers I should be aware off? >i.e. what slows down loops, what speeds up loops. I'm also using a loop to >find the largest value in the small 16 element array, is there a more >efficient method? >Thanks for any advice. >Stuart
|
Sun, 01 Feb 2004 05:54:45 GMT |
|
 |
Duane Bozart #4 / 4
|
 Any tips/hints regarding moving through an array.
Quote:
> Hi, > I've got a program that loops through X/Y co-ords, does some calculations, > stores the results in a tiny array (16 elements), then finds the largest > value in the tiny array, stores this info to a array representing the X/Y > co-ords, then moves onto the next co-ord. > At the moment it take some time to process and I would love to speed it up. > Are there any pointers I should be aware off? > i.e. what slows down loops, what speeds up loops. I'm also using a loop to > find the largest value in the small 16 element array, is there a more > efficient method? > Thanks for any advice. > Stuart
W/O seeing your code, in addition to the already provided point to save the largest quantity as you compute it, make sure you process any 2D arrays in major order...this can make significant processing difference. Beyond these I think seeing code will be req'd to help much. Another, more painful alternative is to write the processing in another language such as C or fortran and call it from VB as a DLL
|
Sun, 01 Feb 2004 08:31:51 GMT |
|
|
|