LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compiled code complexity

Does anyone know how to reduce compiled code complexity of VI?

0 Kudos
Message 1 of 24
(3,798 Views)

Yes. If you provide the code we can help.

Certified LabVIEW Architect
0 Kudos
Message 2 of 24
(3,768 Views)

@Vishnu.R wrote:

Does anyone know how to reduce compiled code complexity of VI?


Have you tried reducing the source code complexity?

========================
=== Engineer Ambiguously ===
========================
Message 3 of 24
(3,766 Views)

@Vishnu.R wrote:

Does anyone know how to reduce compiled code complexity of VI?


 

  • Use (non-inlined) subVIs instead of one gigantic monolithic diagram.

 

What is your current complexity and what kind of problems do you encounter that you blame on code complexity?

Can you show us some code?

 

 

0 Kudos
Message 4 of 24
(3,739 Views)

I have LV project originally developed in 2011. In 2011 its working fine. Now i am writing a same code in 2017.I am using Queued message handler (Design pattern LV2011).Code complexity of a VI is 9.6 after deleting some block of a code. Problem i am facing is whenever i add few code in this VI and try to save it ,LabVIEW becomes unresponsive for a while. RAM usage also increases.

0 Kudos
Message 5 of 24
(3,690 Views)

I can't share my VI here. I have used subVI at most of the possible places.Project includes more than 200 subVI.

0 Kudos
Message 6 of 24
(3,683 Views)

@Vishnu.R wrote:

I am using Queued message handler (Design pattern LV2011).Code complexity of a VI is 9.6 after deleting some block of a code.


You have WAY too much happening in that VI.  Move your QMHs (loops) into individual VIs.  Even better would be to put them in libraries so you can better manage each individual part.  SubVIs will help even more.  A fairly complicated QMH I recently made has a code complexity of 0.4.  Your IDE should have no issues trying to compile that.


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 24
(3,681 Views)

@Vishnu.R wrote:

Code complexity of a VI is 9.6 


How do you determine that complexity number?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 24
(3,634 Views)

@RTSLVU wrote:

@Vishnu.R wrote:

Code complexity of a VI is 9.6 


How do you determine that complexity number?


VI Properties -> Memory usage.

 

For another reference point, I have some legacy test software that's quite functional but isn't optimized and has grown quite a bit since its original effort. It needs a solid refactoring and even includes several 3D graphs, and its CCC is 6.4. If you're around 9 something, you definitely need to be putting more things in subVI's and simplifying logic. If you have VI Analyzer, you can use it to help find some things.

 

A solid rule of thumb: make sure your block diagram is viewable without scrolling left/right or up/down. If you MUST grow things for some reason, make sure you're only growing in one direction.

0 Kudos
Message 9 of 24
(3,628 Views)

@Vishnu.R wrote:

Code complexity of a VI is 9.6 after deleting some block of a code. Problem i am facing is whenever i add few code in this VI and try to save it ,LabVIEW becomes unresponsive for a while. RAM usage also increases.


This is high and make recompiling very expensive. What are your compiler settings (tools...options...environment...last entry). Not only is the recompile slow, it will also force the compiler to take shortcuts in order to speed things up.

 

Note that this is local to the current VI and does not really depend on the number of VIs in the project (unless they are set to be inlined).

0 Kudos
Message 10 of 24
(3,625 Views)