12-07-2023 03:24 AM
Greetings!
I am dealing with receiving data from asynchronous transmission and reshaping it into proper records.
Records are 6400 samples long. Data comes in batches of arbitrary length, which size is always increment of 32 samples (batch = 32, 64, 96, 128..... samples)
Batch can have samples spanning 2 records.
I use a queue to transport the batches from readout loop into reconstruction loop.
We have a predetermined number of records, so the output matrix (number of records x 6400) can be preallocated (and it is)
The picture of the reconstruction loop is attached.
Performance of the loop when the amount of samples per batch is high is quite ok, but when it drops, the performance tanks.
Do You see a way to improve the performance?
12-07-2023 09:44 AM
If you could upload some code that'd be great, we can't debug pictures very well.
What exactly is happening to cause the performance to tank? If you're preallocating the array this seems like it should work fine, especially since this is a queue operation and it sounds like you're dequeueing data after the fact- so timing shouldn't be that critical.
My only thoughts are 1- replace the Divide with a Quotient and Remainder, that will prevent the implicit typecast and will let you remove the To I32 conversion. I'm not sure that really hurts performance though.
If this DID need to be super tight, I'd recommend keeping all of the data in a 1D array, then doing one final reshape array at the very end. Copying stuff, reshaping it, and transposing it means it's moving the data around a bunch, unless the compiler is WAY better at using subarrays than I'm aware of. I'd turn on Show Buffer Allocations and see if you're copying data anywhere.
12-07-2023 03:42 PM
12-08-2023 06:26 AM
If the performance tanks with small batch sizes, then something in your processing has a constant overhead per iteration. As the work per iteration reduces, the constant overhead starts to be the dominating factor in your code.
Can you set up a test where the number pf packets is known and replace the While loop with a FOR loop and get rid of the "FIFO Status" VI to see if it's causing problems?
Another (maybe more likely) factor is having debugging enabled in your VI.