LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

New case in action engine has drastic effect on execution speed. Even after it is removed.

Solved!
Go to solution

I'm using an Action Engine to collect, parse, and write data to queue's for use elsewhere in my program. Data packets are 67 bytes long and arrive at 1kHz so execution speed is fairly important.

 

In its original form the AE averaged 80-90 uS per execution and had no problem keeping up. Adding an empty case to the structure immediately slowed the execution of the AE to 440 uS per iteration, even when the empty case is never called. The perplexing issue being that, after the empty case is removed and the enum control reverted back to its original state, the execution time remains at 440 uS instead of 80.

 

The original four cases were untouched. Has anyone run into this kind of behavior before? I know LabVIEW does a lot of very helpful code modification in the background - changing data representations, moving around buffer allocations... - but I can't figure what could be happening in this case.

 

If you want to play "spot the difference", I'm attaching my AE's for Channel 1 (execution time 440 uS) and Channel 2 (execution time 80 uS).

 

Comparing them side by side with buffer allocations highlighted I cannot find those 260 uS.

 

(I know that's a lot of queues. I can't be helped; the project requires eleven 1kHz data signals to be plotted simultaneously, for each of two channels.)

Download All
0 Kudos
Message 1 of 9
(3,053 Views)

Ah! Forgot to mention. When I revert AE CH1 Read.vi back to the source control version from before the code was changed, it works fine.

 

Unfortunately, I will likely need to add that extra case soon and need some ideas on why it causes an immediate 5-fold increase in execution time.

0 Kudos
Message 2 of 9
(3,048 Views)
Solution
Accepted by topic author AlexK

Hi, Alex,

 

As far as I can understand, you deal with different sizes of array stored in the shift register. Check your Initialize section - in one VI you have initialized array with 1000 elemenths, and in another VI with 5000 elemenths. This makes difference:

 

See attached VI.

 

Andrey.

PS

By the way, its a good idea to post fully functional example, without missing SubVIs, etc.

Message Edited by Andrey Dmitriev on 10-28-2008 04:17 PM
Download All
Message 3 of 9
(3,037 Views)

Hi Alex,

 

Could you please post images of the AE's states both before and after?

 

I don't have a cuurent version of LV on this machine, but with some images I may be able to add some value.

 

Sorry for having to ask,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 9
(3,016 Views)

Ben, I think the mystery is solved. I came to the same conclusion as Andrey, but when I tried to reply, he was a few seconds faster. 😄

 

In the slow case, an important diagram constant is 5x larger (5000 vs 1000), fully explaning the speed difference.

Message 5 of 9
(2,995 Views)

Altenbach and Andrey: synching up those array sizes did seem to do the trick, though I'm still at a loss as to why they were running more comparable execution speeds before the mystery case, even though the array size discrepency was still there. As I mentioned, when I reverted to the source control version it worked, and that version had the 5000 vs 1000 issue as well.

 

I was ultimately able to add the case I needed, though, thanks to you guys pointing out that array size. This takes me back to the C days, pouring over the same block of code for hours only to have your collegue walk by and say "You're missing a semicolon". Sometimes a fresh pair of eyes is all you need.

0 Kudos
Message 6 of 9
(2,969 Views)

AlexK wrote:

...I was ultimately able to add the case I needed, though, thanks to you guys pointing out that array size. ...Sometimes a fresh pair of eyes is all you need.


        

 

"There is wisdom in a multiple of counselors" (Proverbs)

 

Ben

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

AlexK wrote:

...I was ultimately able to add the case I needed, though, thanks to you guys pointing out that array size. ...Sometimes a fresh pair of eyes is all you need.


Welcome!

 

In additional, now you can see why execution time depends from the array size, and how it can be improved (assumed, that you don't need to have whole array on output on each AE call):

 

 

Andrey.

Message Edited by Andrey Dmitriev on 10-29-2008 03:27 PM
Message 8 of 9
(2,947 Views)

Hi Andrey,

 

I don't know if you have seen the "Clear as mud" Thread but since your images showed updating a control (that I am gussing is on the icon connector) inside a case vs on the root of diagram, I want to make sure you have seen what Greg McKaskle* wrote about where when and how controls on the icon connector are updated. That duscussion taught me a bit and changed my understanding about where I put my terminals. Hint: "What gets put that wire when the other cases are executed?"

 

If you knew this already please excuse this note. If you haven't seen that thread you may find it interesting. Smiley Wink

 

Just trying to share what I know!

 

Ben

 

*Greg McKaskle was one of my mentors.

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