> are there reasons for preferring a VI template over a re-entrant VI? Are
> there performance differences when calling these VIs very often?
> 

There are differences.  A vit loads a new copy of code, data, and panel. 
   Since it has a unique panel, it can do its own UI display and can be 
run at top level using the Run method or as a subVI using the Call by 
Reference.

A reentrant subVI uses the same code, same panel, and only duplicates 
the data.  It cannot be run at the top level, only as a subVI.  It is 
easier to use since you don't need to use the Run or Call by Ref, but 
just a subVI node.

So, if you want independent historical or state info per call and don't 
need UI or VI Server control, use reentrant subVI.  If you need UI or VI 
Server spawning of asynchronous tasks, use .vit.

Once the VIs are running, the differences in execution will be due to 
machine architecture.  The more code you have that is executing, the 
more they will get knocked out of the cache, but honestly these are hard 
things to predict or control from any higher level language.  The key is 
to reuse code instead of copying, and that argues for reentrant VIs 
unless you need the other elements.

Final note is that reentrant VIs are harder to debug.  It is best to 
develop them, test them, and then make them reentrant.

Greg McKaskle


Reply via email to