LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Static control references are slow if the UI is busy

Going back to the original problem that the UI thread is dramatically overloaded, an easy test would be to set the graph to "synchronous display", forcing a full redraw before the code is allowed to continue.

 

Now the lower loop time is half a second!!!

 

altenbach_0-1708094572389.png

 

This tells you that while the graph update is asynchronous, once it decides to redraw, the UI thread gets highly taxed for a significant time duration.

 

I still don't quite understand why retrieving a static reference needs to UI thread and is not constant folded.

For example why wouldn't LabVIEW transparently just do the following behind the scene, greatly speeding up the upper loop?

 

altenbach_1-1708095313397.png

 

 

The problem is actually the timing sequence which forces the loop to no longer be constant folded. If we get rid of the time measurements, the upper loop is again very fast and constant folded. (Setting the timeout to zero, gives a loop time in the low microseconds while in the earlier case it was tens of seconds).

 

A clear case where the act of measuring changes the outcome!

 

altenbach_2-1708095859283.png

 

If we eliminate the constant folding artificially, the loop again gets slow. It is not clear to me why the compiler does not treat the static references as loop invariant code. I think it should....

 

altenbach_0-1708096473580.png

 

If we eliminate the auto-indexing on the refs (i.e. make the tunnel "last value" and the array 1D), the loop speeds up 32 times because the compiler is smart enough to only retrieve the references on the last iteration:

 

altenbach_0-1708096847623.png

 

Message 11 of 12
(237 Views)

thanks for sharing...

0 Kudos
Message 12 of 12
(160 Views)