Summary: The performance of VIs whose reentrancy setting is Preallocated clone reentrant and whose priority setting is subroutine should be increased to match the performance of inlined VIs (VIs with the Inline subVI into calling VIs setting ticked).
Details: I have been benchmarking a few simple mathematical subVIs. My goal was to understand the performance associated with various VI execution settings configurations: Non-reentrant (NR) vs. Shared clone reentrant (SCR) vs. Preallocated clone reentrant (PCR), Allow debugging on vs. off, and subroutine priority vs. inline.
The benchmarks showed that, taking mathematical subVIs whose reentrancy is Preallocated clone reentrant:
What I didn't expect was that the performance increase when the VI is inlined is larger than when the VI uses subroutine priority. In other words, the benchmarks showed that in-lining a VI makes it around 5.0% to 6.3% more performant than when the VI is subroutine. This also means that the best possible performance is achieved by inlining VIs rather than setting them to subroutine.
The chart above shows the relative performance of the same set of three mathematical subVIs when all three VIs are set to subroutine vs. when they are inlined. One Loop means a benchmark caller VI that contained a single for loop that contained a chain of the three subVIs. Two Loops means the for loop was duplicated, such that two identical for loops executed in parallel. Four Loops means that the two for loops were duplicated again, such that there were four for loops executing in parallel. The Y axis represents the number of iterations the loops were able to perform in a given amount of time (2 seconds). When the benchmark caller VI used two or four loops, the Y axis value is the arithmetic average of the iterations of each of the two/four loops.
As can be seen in the chart, there is a small but consistent performance improvement when VIs are inlined. This small performance gap remained relatively constant in three circumstances:
This showed that this performance gap is currently immune to the maximum compiler optimisations or to being built into an EXE.
This idea requests that when a subVI is set to subroutine, the compiler should treat the VI as if it was inlined, and therefore apply any/all possible performance optimisations to calling the subVI.
This is in accordance with a comment that Altenbach made to this excellent idea:
For avoidance of doubt, inlining VIs has a drawback: it makes the LabVIEW editor sluggish. That's why simply "inline all VIs and forget about subroutine" is not a great advice - it would make the editor very sluggish. This is something that can be observed when working with lots of malleable VIs (VIMs), which by their nature must be inlined. Subroutine VIs do not slow down the editor. If this idea was implemented, it would enable achieving the best possible execution performance without slowing down the editor.
All testing was done using LabVIEW 2026 Q3 Patch 1 (26.3.1f1) (64-bit) on Windows 11.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.