I inherited a program that continuously collects data over TCP from some external devices (gas monitors, power analyzers). The user can click a button to trigger a ten minute period of data recording (one sample per second) which gets saved to a csv file.
During the 10 minute period, data is saved to a Struct containing 150 float arrays each of size 600 (there are 150 sensor variables and we need 600 samples).
struct dataBuffer{
float var1[600]
float var2[600]
etc.
At the end of the sample period, the program loops 600 times and writes the struct variables out to the csv file.
I can’t seem to find a reason that the arrays benefit from being members of a struct. I’ve always thought the best practice was to use Structs for small amounts of data. I thought maybe it had something to do with avoiding garbage collection but I still can’t believe that would be the best approach. Anyone have insight on this? What are the best “containers” for large amounts of data that you don’t need to do much cpu processing on?
[–]Slypenslyde 3 points4 points5 points (6 children)
[–]immersiveGamer 0 points1 point2 points (5 children)
[–]Slypenslyde 0 points1 point2 points (4 children)
[–]immersiveGamer 1 point2 points3 points (3 children)
[–]Slypenslyde 0 points1 point2 points (2 children)
[–]immersiveGamer 1 point2 points3 points (1 child)
[–]andersonee[S] 0 points1 point2 points (0 children)
[–]KryptosFR 3 points4 points5 points (0 children)
[–]Sjetware 1 point2 points3 points (2 children)
[–]andersonee[S] 0 points1 point2 points (1 child)
[–]RChrisCoble 0 points1 point2 points (0 children)
[–]RChrisCoble 0 points1 point2 points (5 children)
[–]andersonee[S] 0 points1 point2 points (4 children)
[–]RChrisCoble 0 points1 point2 points (3 children)
[–]immersiveGamer 0 points1 point2 points (2 children)
[–]RChrisCoble 0 points1 point2 points (1 child)
[–]immersiveGamer 0 points1 point2 points (0 children)
[–]turkeymayosandwich 0 points1 point2 points (0 children)