03-26-2024 09:13 AM
@Quiztus2 wrote:
Do you also have a good idea on the pixel extraction along all images?
Since the difference their is still big.
The reason it is large is because you are reshaping the array then extracting. Your FGV is complicated, you have multiple array inputs and outputs. I would suggest simplifying it.
To increase your pixel extraction rate you need to operate on your 1d array in your DVR. You can do something like below, make sure you specify the correct pixel, I am not sure I did,
That reduced the pixel extraction time by a factor of at least 10, still more than the DVR though. Parallelizing the loop did not make any difference.
03-27-2024 09:25 AM
For the sake of completeness, here my latest results comparing 3D,1D and DVR based approach.
03-27-2024 10:45 AM
@Quiztus2 wrote:
For the sake of completeness, here my latest results comparing 3D,1D and DVR based approach.
So this is just guessing here why the value based approach is slow. The compiler "does not know" what is on the wire, so data copies are made; you don't have that issue with the DVR.
When I do these types of FGVs I try to never branch or break the wire. If I try that with your code, the VI is broken because the compiler does not know what is on the wire. See below. I modified the "Write" part so the wire never breaks, but now the VI is broken. Lastly just do your read off the shift register, no need to branch another wire. It makes no difference here, but IMO it's cleaner to read off the shift register then have another wire branch in the diagram.
03-27-2024 11:54 AM - edited 03-27-2024 11:58 AM
Lastly just do your read off the shift register, no need to branch another wire. It makes no difference here, but IMO it's cleaner to read off the shift register then have another wire branch in the diagram.
Reading directly the shift register makes a huge difference for the 3D case. The Replace and Read times are now the same for 1D and 3D. Very interesting. Actually the difference in manipulating a 1D vs 3D really didn't make sense for me before.
The remaining huge difference between 3D and 1D single extraction is not justifiable from my perspective.
03-27-2024 12:13 PM
Surprised it made that much of a difference; I did not test but the memory address for the wires was the same so I assumed no difference.
For me, never breaking the wire usually helps with memory copies, that is why I use the reshape array on the original wire when possible, that way the buffer can be reused. Branches can also result in copies as you have seen.