LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Optimising execution speed - integer rotation

Solved!
Go to solution

Having a slow first iteration is of course not really desirable, so that loop really belongs on the diagram before the toplevel loop so it runs as part of the startup

 

I have many places where rarely (or never) changing large data structures are calculated on first run or whenever an input changes.

 

For example here's a subVI that returns a special ramp that gets cached on first run and then gets just read from the shift register unless the input changes. If there is no input to the code, I would use a First Call?  for the condition.

 

 

altenbach_0-1787671488853.pngaltenbach_0-1787671488853.png

 

Another benefit of this is the fact that the output is guaranteed to be binary identical across all parts of the program code. Long ago, it took me quite a while to troubleshoot random map misses that seem to occasionally happen even if the diagram code is identical (!!!), because the compiler might internally reorder differently in different instances of the same program. Read more about it here.

 

 

0 Kudos
Message 31 of 31
(42 Views)