Array vs Counter speed
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Array vs Counter speed
It probably doesn't matter much due to the small size but I was wondering if there is a resource and speed preference, between a counter and an array that both store and sum intra-day data over a 20 day period ? (for calculating ADR etc)
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Array vs Counter speed
If I understand you correctly, a counter will be quicker. With an array, you either have to (a) loop through the array to determine the sum or (b) loop through the last bars to fill the array and then loop through the array to calculate the sum.It probably doesn't matter much due to the small size but I was wondering if there is a resource and speed preference, between a counter and an array that both store and sum intra-day data over a 20 day period ? (for calculating ADR etc)
If situation (b), a simple variable will be quicker since that saves the time to loop through the array.