X___ Posted April 9, 2021 Report Share Posted April 9, 2021 I recently ran into an interesting problem: some calculations I was doing in which I used parallelized loops were taking an inordinate amountĀ of time (and consuming 100% of my i9 cores). Turning to profiling to figure out where I might be bugging out or able to find some optimization, I realized that the most active subVI was this: Ā Error Cluster from Error Code.vi There is an interesting discussion elsewhereĀ about why this VI is a nuisance (even in its modernized version), which is compounded by the facts that: - it is randomly used by NI in its code (some error codes are never converted, let alone passed, so good luck to figure out why your code fails) - there is no particular discipline (from NI) on how it is used (for instance, random error codes (aka 1)Ā areĀ plumped on the diagram and connected to said ECfEC VI - it is used in locked VIs (super secret ugly code, presumably) For kicks, I zapped it and replaced it by a simple version of mine everywhere I could (that is, except in the locked VIs) and reran my calculation. Same symptoms. The locked VIs were for sure not the problem, as they were not called during the calculation, so I had to find out where this VI was called from and narrowed it down to one caller. I opened up the diagram... and did not find it there. However, I had two Error Ring "constants" on the diagram which, you probably know that or have figured it by now, I didn't, calls ECfEC.vi. One of the Error Ring, O Irony!, was a "no error" Error Ring "constant" (no comment): Therefore, merely running that subVIĀ (which was supposed to be quasi-instantaneous), was now launching LabVIEW into the ECfEC.vi maze and hogging my computer. I have now removed the incriminating Error Rings and moved on, but I thought this potential issue should be better advertised. My 2 cts. 2 2 Quote Link to comment
Darren Posted April 9, 2021 Report Share Posted April 9, 2021 During code reviews I always tell people to remove 'No Error' error rings and replace them with error cluster constants. As for non-0 Error Rings, they should always be in a case structure that only executes in the situation where you need that Error Ring value. Quote Link to comment
X___ Posted April 10, 2021 Author Report Share Posted April 10, 2021 1 hour ago, Darren said: During code reviews I always tell people to remove 'No Error' error rings and replace them with error cluster constants. As for non-0 Error Rings, they should always be in a case structure that only executes in the situation where you need that Error Ring value. That's good advice, which could be added to the Help for the Error Ring, for instance... 1 Quote Link to comment
thols Posted April 12, 2021 Report Share Posted April 12, 2021 (edited) On 4/10/2021 at 1:24 AM, Darren said: During code reviews I always tell people to remove 'No Error' error rings and replace them with error cluster constants. As for non-0 Error Rings, they should always be in a case structure that only executes in the situation where you need that Error Ring value. Very interesting. Error rings are so largeĀ I am tempted to put them in a sub-VI just for that reason. And if they also always should have a case structure around them... I agree that it should be documented, and I had a look in the help to see what it said and found that LV2020 displays: However, LV2019 works. Is it only me? (its only on the error ring, everything else in the help seems to work) Edited April 12, 2021 by thols add info Quote Link to comment
LogMAN Posted April 12, 2021 Report Share Posted April 12, 2021 1 hour ago, thols said: Is it only me? Got the same issue in LV2020 SP1 The page exists, it is just incorrectly linked Quote Link to comment
X___ Posted April 12, 2021 Author Report Share Posted April 12, 2021 As a note, a quick performance test comparing dropping a constant or an error ring in a case and running this over and over doesn't seem show much of a difference inĀ terms of CPU (but benchmarking could probably done more carefully), so I may have just used up bandwidth for not much, as usual... š 1 Quote Link to comment
Darren Posted April 12, 2021 Report Share Posted April 12, 2021 I have reported the documentation issues (both the 'page not found' error, and the suggestion about placing error rings in case structures) to R&D as Bug 1413653. 12 hours ago, thols said: Error rings are so largeĀ I am tempted to put them in a sub-VI just for that reason. Don't forget you can deselectĀ Visible Items > Error Explanation TextĀ if you need your Error Rings to be more compact: 2 Quote Link to comment
thols Posted April 13, 2021 Report Share Posted April 13, 2021 10 hours ago, Darren said: I have reported the documentation issues (both the 'page not found' error, and the suggestion about placing error rings in case structures) to R&D as Bug 1413653. Don't forget you can deselectĀ Visible Items > Error Explanation TextĀ if you need your Error Rings to be more compact: Ā Thanks Darren, I didn't know that. Maybe because that is also not in the help. Quote Link to comment
Darren Posted April 13, 2021 Report Share Posted April 13, 2021 9 hours ago, thols said: Thanks Darren, I didn't know that. Maybe because that is also not in the help. I updated the Bug report to mention that this should be in the help. Also, I talk a lot about use cases for the Error Ring (including mentioning several of the points I brought up in this post) in my What To Expect When You're Expecting an Error presentation here: http://bit.ly/dnatterrors 2 Quote Link to comment
Darren Posted April 13, 2021 Report Share Posted April 13, 2021 6 hours ago, Darren said: I updated the Bug report to mention that this should be in the help.Ā Hmm, I should have actually looked at the Help before doing that... our tech writer kindly pointed out thatĀ Visible Items > Error Explanation TextĀ is already present in the Error Ring help. Quote Link to comment
thols Posted April 14, 2021 Report Share Posted April 14, 2021 7 hours ago, Darren said: Hmm, I should have actually looked at the Help before doing that... our tech writer kindly pointed out thatĀ Visible Items > Error Explanation TextĀ is already present in the Error Ring help. Ā How could I miss that... I'm sorry for that.Ā Quote Link to comment
X___ Posted December 12, 2022 Author Report Share Posted December 12, 2022 (edited) Another interesting tidbit: you cannot "Find All Instances" of an error ring. And you cannot search for an error code (or an error message for that matter) and expect error rings to be returned as part of the search results. The error rings live in a separate...ring (the mathematical structure). Yet, they are pretty much indispensable if you use custom error codes... Edited December 12, 2022 by X___ Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.