LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI optimization question

Which is better for LabVIEW/MathScript Optimization:

  • to put many lines of code into a single MathScript Node (more emphasis in MathScript)
  • to break the program into functional chunks of several MathScript notes (less emphasis on MathScript)

The answer could say "neither".

 

More details:

  • this is a decently large simulation
  • I can assemble it more quickly in discrete chunks

 

0 Kudos
Message 1 of 6
(2,559 Views)

Which key are you referring to when talking about "optimization"?

I assume execution speed. In that context, my recommendation is to completely skip MathScript and implement everything in one language (that might also be true for memory optimization as well).

When you HAVE to use MathScript, you should try to not toggle around between LV and MathScript often. That means that depending on your preferences (e.g. by skill), you should implement most of the task in the language you prefer (e.g. LV) and leave only little tasks to the other language.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 6
(2,539 Views)

Agree that breaking it into chunks that can run pure LabVIEW would be the best (subVIs and no MathScript).  My gut feel is that you will see better optimizations as a single MathScript Node if you had to go that route (changing contexts is usually hard on a program).


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 3 of 6
(2,524 Views)

How large is "decently large"? What makes it large? (complicated system, long running, etc.)

0 Kudos
Message 4 of 6
(2,495 Views)

I will join the choir and say the best way to optimize the speed of MathScript is to not use MathScript.

 

The LV compiler is absolute genius when it comes to breaking up code into clumps and make full use of all of the CPUs.

 

paraphrasing from Tommy by the Who "...He can beat my best. That deft lean, compiler, sure writes some mean machine code."

 

I do not believe it is quite as amazing once you step outside the world of wires.

 

Just my 2 cents,

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 6
(2,488 Views)

@Altenbach

 

>>How large is "decently large"? What makes it large?

 

Answers:

  • Large finite difference/fluid flow simulation with phase change and heat transfer
  • ~1M loops through the integrator to get a few seconds of time
  • ~2k components of varying complexity

 

0 Kudos
Message 6 of 6
(2,482 Views)