LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Functional Global Variable performance

In my LV applciation (8.2), I created a FGV for a GUI interface.  I implemented it with an Enum as command (Set, Read, Write) input, wiring it to a While loop and a Case structure. It worked and the benchmark of the FGV functionc call in a loop looks good. But I found very strange thing happening is that when I removed the "Write" item in the Enum and removed the "Write" in Case structure, which menas I only have two items in Enum and two cases in the code, it actually slows down the FGV function call (like Read), 20x or 30x slow.  Once I added the dummy "Write" back to Enum and the Case structure, it worked just fine. I don't understand why. 

0 Kudos
Message 1 of 10
(4,660 Views)

Post screenshot/code (and post the benchmarking code as well!). Those performance issues are really complicated, but some have an eye for it. On this level, there are tricky thingys happening with compiler improvments, buffer reuse (and this depends weather your terminal is inside or outside the case structure)...

First thing you can do your own is to use 'show buffer allocation'.

Some background info can be found in the famous clear as mud post.

 

Felix

0 Kudos
Message 2 of 10
(4,658 Views)

the code is attached.

0 Kudos
Message 3 of 10
(4,648 Views)

Felix may be on to something here, try putting all of your controls and indicators on the root diagram instead of inside the case structure.

0 Kudos
Message 4 of 10
(4,635 Views)

I moved the two indicators inside the True/False case out and out them outside of the While loop.  I tried the code with 3 Enum inputs works fine with 0 tick(ms), but I changed the code only get 2 Enum inputs, it just slowed down, 20 ticks (ms) for a Read. I used Tick Count in a flat sequence structure for my benchmark.

0 Kudos
Message 5 of 10
(4,626 Views)

I don't have LV on most of the PCs I use for internet access, so for me a screenshot would be nice.

 

Concerning your benchmarking, cause a lot of things might happen due to your OS scheduler and the LV schewduler, running it a single time doesn't produce a reliable number. Run the code inside a for loop for 1k times. See a later post by Greg in the Clear-as-mud thread.

 

Felix

0 Kudos
Message 6 of 10
(4,609 Views)

I don't really see any time difference in LV9, so let me guess that there is some type of compiler optimization that has occurred since LV8.2.  Quickly looking at the code gives me one guess:  Try wiring the Input Array all the way across the While loop in both cases (assuming you have deleted one case).  If that doesn't change anything, wire an indicator to the output tunnel.  If that doesn't work, wire a dummy case....Smiley Wink

 

 

Message 7 of 10
(4,598 Views)

I wired the Input array all the way across the While loop in both cases and wired it to an indicator. It works!  It bothers me for a while. I'll try the code in LV9. Thanks Darin! 

0 Kudos
Message 8 of 10
(4,589 Views)
I'd usually much rather scratch my head wondering why something works as opposed to wondering why something doesn't work.
0 Kudos
Message 9 of 10
(4,575 Views)

Hi, Darin:

 

I'm not so sure about that.  I'm afraid if I don't know how something works, I won't be able to fix it if it breaks.  However, scratching your head because something DOESN'T work is great scalp massage. 😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 10
(4,533 Views)