LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using single frame flat sequence structure to help clean up diagram

Are there any performance or other drawbacks in using a single frame flat sequence structure to help clean up the diagram? Sometimes it helps the automatic clean up routine create clearer code.

 

0 Kudos
Message 1 of 9
(4,006 Views)

The LabVIEW compiler is pretty good, but you are creating extra tunnels and synchronization boundaries so there might be a minimal performance hit, depending what else is going on. Probably insignificant.

 

This seems to be a single-function re-usable code fragment, so I would probably convert it into an inlined subVI. Only NOW the diagram is significantly cleaner!

 

(note that the inlined subVI acts exactly as your single frame sequence)

Message 2 of 9
(3,972 Views)

1. I never use the Autocleanup tool for reasons like this.

2. I would actually use an In Place Element Structure there.  I find is easier to read and you do not have to route the cluster wirs around the code.  It will actually compile to the same thing.

3. You could run into the situation where the sequence stucture actually prevents LabVIEW from being able to compile things in parallel and therefore slow down your code some.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 9
(3,964 Views)

One of those few times I'll diagree with Tim.  What you show is a "Magic Pattern" with the un-bundle / bundle "Inplace"  The compiler recognizes that since at least 2011 and optomizes it inplace.  you need niether sequence nor in-place elemant structures!  (in fact both will add some minor overhead for synch bounrdies.)  That being said I do not know what the downsteam branch of the cluster wires too.

 

Diagram clean-up  (you mean Ctrl+U right?)  does have some levers in the LabVIEW.ini file that can be tweaked with Menu>>Tools>>Options.  I have never found a one-size-fits-all set of tweaks to those settings but do have a custom menu short-cut to help me tweak those settings on the fly.  Better, you can select BD oject to clean-up or prevent BD clean-up from moving some objects via right-click options.  Those would be more effective from what you've shown.  (Again, I got a picture not complete code)


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 9
(3,949 Views)

@JÞB wrote:

One of those few times I'll diagree with Tim.


I actually agree with Tim.... but wait there's more (:D)

 

If we only operate on a subset of cluster elements, the IPE seems the most natural (top).

If we operate on all elemens (or at least most, we could just "add" zero to the rest), I would just operate on the cluster directly (bottom)

 

Message 5 of 9
(3,933 Views)

Thanks for refactoring suggestions but i am really more interested in the particular impacts of using an "unnecessary" single frame sequence structures as I use the auto diagram clean up extensively and sometimes, actually rarely, a sequence clears things significantly.

 

So far :

 

extra tunnels and synchronization boundaries (probably insignificant)

- could prevent LabVIEW from being able to compile things in parallel and therefore slow down your code some

 

Would like more information on "synchronization boundaries" and if possible an example where parallelization could be impaired.

 

Also would like to know if it would be better to use a single fram disable structure or even an unconfigured in place structure.

 

 

0 Kudos
Message 6 of 9
(3,929 Views)

Not your exact scenario, but a good discussion to read through anyways: Both disable structures should have less effect on diagram synchronization


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 9
(3,916 Views)

I don't think there is an issue with the flat sequence in your case (single input and output and no other dependecies).

 

Other cases might not be that clear, for example of you would wire top top cluster wire across the frame too, it would not be able to start processing the upcoming code until the sequence has finished, forcing serialization.

 

I think the sequence as you use it is perfectly fine, performance wise. 😄 

0 Kudos
Message 8 of 9
(3,909 Views)

Re-iterating,  a synchronization boundary is fairly insignificant.  Parallelization is less of the right term than inplaceness.  Inplace operations can re-use the same memory space, or buffer, and speed up code by reducing the need for the run-time engine to ask the OS for some memory.  In your picture, inplaceness is not affected at all by either ther IPE or the FSS.  Therefore, I went down the road of block diagram clean-up tips and tricks.

 

If a Single frame sequence or IPE structure helps you organize your BD- do it!   Structure sub-diagram labels can be very effective too and are more than worth the pico-seconds per iteration when you need to modify the code.


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 9
(3,901 Views)