LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inlining and subroutine settings on RT

I ran into something unexpected this week when benchmarking some RT code in LV 2012 SP1.

 

We're currently porting code from essentially 8.5 via 2011 to 2012 SP1.  I started changing the sub-vi calls in a timed loop on the RT system from subroutine to inlined with pre-allocated clones.  In doing this I had changed the VIs to inlined but forgot to change the subroutine setting.  In this configuration the executaion was SLOWER than with just subroutine set.  Removing the subroutine setting made the code faster than originally.

 

My initial thought was "Why on earth does the subroutine setting have an effect on inlined code"?

 

Can anyone comment on this?

 

Shane

0 Kudos
Message 1 of 6
(2,843 Views)

Well, the subroutine could be defined within programs, or separately in libraries that can be used by multiple programs. And since the Inline function, whenever used, calls the entire body of the function, the Inline has be hence called from all libraries. If they are used by multiple programs, this could possibily make your execution slower.

0 Kudos
Message 2 of 6
(2,831 Views)

When you set a VI to Inlined LabVIEW ignores the execution priority, so it shouldn't have mattered that the priority was left on subroutine (link). The fact that it did matter is very odd. Is this performance degradation behaviour repeatable?

 

 

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 3 of 6
(2,813 Views)

I saw the difference two days ago.  I'm just getting back into testing so I'll try it again and report back.

 

It seemed pretty repeatable at the time.

 

Shane.

0 Kudos
Message 4 of 6
(2,800 Views)

Was it just a little bit slower or a lot? Did you force a recompile a couple of times to see if the problem is repeatable?

 

If you inline code, you increase the complexity of the calling diagram and thus might hit a compile threshold earlier. This would result in less optimization. Just a wild guess.

0 Kudos
Message 5 of 6
(2,791 Views)

The weird thing was when I set the execution back from subroutine, it ran faster again (still inlined).

 

Just writing this, I might have an idea as to what I really saw.  I'll test it tomorrow.

 

Shane.

0 Kudos
Message 6 of 6
(2,786 Views)