Jump to content

Compiled Code Complexity analyzer for LabVIEW 2012


Recommended Posts

Hi all -

I've just posted a tool to analyze compiled code complexity of VIs in a project at http://forums.ni.com...12/td-p/2121692. Note that compiled code complexity is a new feature in LabVIEW 2012, and so this won't work with earlier versions.

I'd be happy to answer any questions here or on the forums!

(is it kosher to spam LAVA with links to forum posts? If not, my apologies...)

Greg Stoll

LabVIEW R&D

Link to comment

Interesting little project that opens up a couple of possibilities (like automagically in-lining those identified as capable of being in-lined). Maybe it can be used for older versions by running it in 2012 and back-saving to a previous version (2010/2011?). Can it be extended to include or say something about subroutined vis?

I get many error prompts (error 1026 occured at Close reference-vi ref invalid) when scanning either a directory or a project. I can get file output and do analysis though.

A bit of documentation wouldn't go amiss as to what "complexity" actually means and what can be gleaned from it. I assume a complexity of >5 is "too complex"? Does this mean it is a candidate for refactoring?

If a vi is marked as "Partially Optimised", what does it mean and what can be done about it, if anything? etc.

It Needs a bit of love ;), but very interesting.

Edited by ShaunR
  • Like 1
Link to comment

I get many error prompts (error 1026 occured at Close reference-vi ref invalid) when scanning either a directory or a project. I can get file output and do analysis though.

Ah, thanks - I forgot to turn off automatic error handling. I've posted a new version of the code that should fix the problem.

Interesting little project that opens up a couple of possibilities (like automagically in-lining those identified as capable of being in-lined). Maybe it can be used for older versions by running it in 2012 and back-saving to a previous version (2010/2011?). Can it be extended to include or say something about subroutined vis?

Ah, it certainly could do that - at its core (complexity data.lvclass:create from VI.vi) it's just getting some properties from the VI, so that certainly could include subroutine VIs, or you could save it for previous and get rid of the code complexity stuff.

A bit of documentation wouldn't go amiss as to what "complexity" actually means and what can be gleaned from it. I assume a complexity of >5 is "too complex"? Does this mean it is a candidate for refactoring?

If a vi is marked as "Partially Optimised", what does it mean and what can be done about it, if anything? etc.

There are new topics in the LabVIEW help about this, but briefly:

"Code complexity" is a new metric based on the complexity of the compiled code. By default, if a VI's code complexity is >5, we will turn off some compiler optimizations to speed up compile time. (this is configurable in Tools->Options->Environment->Compiler) So VI's that are that complex are definitely a good candidate for refactoring.

Thanks for checking it out!

Link to comment
  • 6 months later...

What is the impact of this Code Complexity threshold on built applications? I'm hoping that it has no impact, that when you perform a mass recompile or build into an application that all compiler optimizations are enabled, since the editor response time isn't really part of the equation. Can someone confirm this is true for me?

Link to comment
What is the impact of this Code Complexity threshold on built applications?

 

The app builder uses the same value as the IDE to decide whether to do full optimizations. You could have a pre-build step which sets the global property to a low value (or is it high? I don't remember) to get more VIs to be optimized and a post-build step to reset the property.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.