LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace Array Subset in FGV slow

Solved!
Go to solution

As a very general comment, please don't attach code as snippets when including called subVIs, because a lot of functionality is stripped out (e.g. terminal assignments, execution settings, etc. etc.).

 

Please take your toplevel VI and do a "save for previous" (2020 or below) and you'll get a new folder containing all relevant VIs (incl. dependencies) and as a bonus, they'll be in a version many more of us can open..

 

Zip it up and attach. Thanks! (... and if you do, I'll even have a look at it!)

0 Kudos
Message 11 of 25
(284 Views)

@Quiztus2 wrote:

I experience a huge performance boost with this version of the fgv.
I am 90% sure this comes from switching from 3D to 1D. 

fgv fast.png

I don't know DVR, but sound interesting.


One possible issue, not sure how smart the compiler is. Run your wires through for all the cases, do not use "Use Default if unwired". Sometimes the compiler is not sure if the buffer will change because now you have an unwired case. Because of that, it may make a copy somewhere which would slow down your FGV.

0 Kudos
Message 12 of 25
(265 Views)

I wired all tunnels

test.png

I'll give DVR also a try

replace.png

0 Kudos
Message 13 of 25
(251 Views)

The replacement using DVR needs < 1 ms in contrast to 40 ms value based.

The reading and creation of the array values again from DVR is slower than value based.

Quiztus2_0-1711151896374.png

FGV Replace DVR.png

FGV Replace DVR vi.png

0 Kudos
Message 14 of 25
(245 Views)

I think, part of your benchmark also included penalties for displaying arrays on the FP.

Just as suggestion - do it like this, this should improve execution time a little bit:

Screenshot 2024-03-23 09.09.42.png

Message 15 of 25
(220 Views)

@Quiztus2 wrote:

The replacement using DVR needs < 1 ms in contrast to 40 ms value based.

The reading and creation of the array values again from DVR is slower than value based.

 

FGV Replace DVR.png


What happens if you parallellize the DVR read loop?

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 16 of 25
(174 Views)

Parallel recreation of native array from DVR is slower than sequential.

 

For me important is, that my critical usecases:

  • Exctraction of single pixel along all images
  • Replacement of single image

are significantly faster using DVR. I assume here that the DVR creation from an array doesn't take significant time. 

 

Quiztus2_0-1711391218765.png

fgv dvr.png

0 Kudos
Message 17 of 25
(163 Views)

@Quiztus2 wrote:

I assume here that the DVR creation from an array doesn't take significant time. 


The DVR method is still the fastest in my quick look at it, although I think the test should be modified like below to include DVR Creation. (Even with the mod, DVR is the fastest.)

mcduff_0-1711392888940.png

 

The reason the FGV Replace (NON_DVR) is so slow, it appears LabVIEW is making multiple buffer allocations with that method. If you look at the "Profile Buffer Allocations" Tool you will see lots of buffer copies of the data. I believe that is why it is much slower.

 

mcduff_1-1711393055837.png

 

 

0 Kudos
Message 18 of 25
(155 Views)

Some quick mods on my computer and DVR case is now slower. VI is attached, below are the mods.

 

The region below in the sequence structure is not needed; it was only to initialize your values to 8888 so the equals works. You can keep if desired.

mcduff_0-1711395139675.png

mcduff_1-1711395180322.png

No need to reshape the array

 

For my test I included the DVR creation, like in my earlier reply.

mcduff_2-1711395264299.png

mcduff_3-1711395324819.png

 

 

 

 

 

 

Message 19 of 25
(147 Views)

I like the idea to use reshape instead of initing the array in the "reinitialize" case.
I also like to use rowise replacement instead of reshaping 🙂 very nice.

 

Do you also have a good idea on the pixel extraction along all images?

Since the difference their is still big.

0 Kudos
Message 20 of 25
(117 Views)