LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mathscript node calls the "Merge Errors.vi" many times

Using the profile performance tool, I note that my code which has only one node, a MathScript node, is calling the "Merge Errors.vi" more than a twenty thousand times. The code inside the MathScript node is not so complicated, although it has some loops and manipulate vectors with almost 1200 double numbers. 
0 Kudos
Message 1 of 7
(3,290 Views)
You must have that VI on your block diagram, or perhaps it's inside a subVI. MathScript wouldn't be calling that VI. Can you post your code?
0 Kudos
Message 2 of 7
(3,273 Views)
Hello,

Actually, MathScript does call that VI... and quite often.  We do have a wrapper around it, though, which prevents it from showing in your VI hierarchy.  This is one of the remnants of code generation that we have been cleaning up over the past few releases.  In many cases, the additional overhead of calling this VI is not significant.  However, in a tight loop, it certainly can be.  We are looking to improve this for a future release.  If performance is an issue for you, perhaps consider writing that portion of your loop in LabVIEW.  Still, if you wouldn't mind sharing your MathScript code, it will help us to improve our code generation.

Grant M.
Senior Software Engineer | LabVIEW MathScript | National Instruments
0 Kudos
Message 3 of 7
(3,260 Views)

GrantM wrote:
Hello,

Actually, MathScript does call that VI... and quite often. 

Really? Yuck. Smiley Tongue And this is documented where?

0 Kudos
Message 4 of 7
(3,256 Views)
No problem, I can share my code.
0 Kudos
Message 5 of 7
(3,225 Views)

boechat wrote:
Using the profile performance tool...

If you are using a newer version of LabVIEW (definitely 2009 and I believe 8.5 and 8.6 as well), you will see a performance improvement by removing the continue statement in your code.  The difference will be more pronounced in 2009 because we can generate more optimal code if you write your code and omit that statement.  An alternative is to set a boolean value in your if-statement check and then wrap the rest of the loop in another if-statement that executes only if the boolean value is true.  Remember to reset your boolean before the next iteration of the loop.

 


smercurio_fc wrote:

Really? Yuck. Smiley Tongue And this is documented where?


This is not documented.  It is just an implementation detail.  It is part of the reason why MathScript is not currently as fast as a native LabVIEW implementation, but again, we are working to improve the generated code.  Does this particular detail cause you a lot of pain?

 

Grant M.
Senior Software Engineer | LabVIEW MathScript | National Instruments

0 Kudos
Message 6 of 7
(3,200 Views)

GrantM wrote:

If you are using a newer version of LabVIEW (definitely 2009 and I believe 8.5 and 8.6 as well), you will see a performance improvement by removing the continue statement in your code.  The difference will be more pronounced in 2009 because we can generate more optimal code if you write your code and omit that statement.  An alternative is to set a boolean value in your if-statement check and then wrap the rest of the loop in another if-statement that executes only if the boolean value is true.  Remember to reset your boolean before the next iteration of the loop.

 



 

I am using the LabVIEW 8.6. I removed the continue statement, but I didn't see a real performance improvement.

0 Kudos
Message 7 of 7
(3,170 Views)