Showing results for 
Search instead for 
Did you mean: 

Priority Higher than Normal is slower

Go to solution

The two subVIs below have exactly the same code, a simple addition.


The top subVI is set with a priority of "High" and the bottom subVI with a priority of "Normal". The calling VI is set to "Normal priority". After running, High Priority time is about 20-30x larger than Normal Priority time. Any priority higher than normal except Subroutine gives the same result. Why?


I could understand if there were no benefit to make the priority higher but  I am surprised that it makes the subVI runs slower.

Priority testing_BD.png

Marc Dubois
HaroTek LLC

0 Kudos
Message 1 of 3
Accepted by topic author MarcDub

VIs running at different priorities run in different threads (see 'LabVIEW has five "execution systems", and each execution system allocates threads for four different normal priorities...The "background priority" does not normally have threads allocated for it. VIs running at this priority will use the next higher priority threads when nothing else is available to run.'). So, each call to your high-priority subVI causes a thread switch, and that's what's taking up all the extra time. If you put the entire For loop into the high-priority VI, you'll see that it executes faster than the normal-priority loop.


The lesson here is that VIs that do very little should execute in the same priority as their caller. Use differing priorities for long-running VIs, for example ones that loop repeatedly. If you need a simple function to execute as fast as possible, use subroutine priority or inline it.

Message 2 of 3

Thanks, that is what I thought but could not found a reference.

Marc Dubois
HaroTek LLC

0 Kudos
Message 3 of 3