01-10-2011 04:49 PM
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.
01-10-2011 04:59 PM
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
01-10-2011 05:08 PM
the code is attached.
01-10-2011 05:24 PM
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.
01-10-2011 05:47 PM
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.
01-10-2011 05:56 PM
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
01-10-2011 06:46 PM
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....![]()
01-10-2011 07:13 PM
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!
01-10-2011 08:19 PM
01-11-2011 04:11 PM
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. 😉