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
(4,217 Views)

Yes. If you provide the code we can help.

Certified LabVIEW Architect
0 Kudos
Message 2 of 24
(4,187 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
(4,185 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
(4,158 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
(4,109 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
(4,102 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
(4,100 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
(4,053 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
(4,047 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
(4,044 Views)