LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open VI reference for VITs and VIs

Hi

 

I have a VIT and I get the reference using the Open VI reference. When I change (rename) this back to a VI, and get the reference for it, its much faster. Does the open VI reference takes longer for VITs than VIs in obtaining a reference?

 

Another question  is the same VIT, takes lesser time to get the reference using the Open VI reference in LabVIEW 8.5.1. It takes longer in LV8.6. Why is this happening? 

 

Thanks

Vaa San.

0 Kudos
Message 1 of 14
(4,702 Views)

Personally, I have never really noticed any inherent time difference between opening a VI and a VIT. Any difference would be due to the fact that opening a VIT always makes a new instance of it in memory. On the other hand, opening a VI is a process of opening a reference to an object that (depending upon the application logic) might already be in memory. Can you show an example of the code you are using?

 

I can't comment on differences between 8.5.1 and 8.6.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 14
(4,685 Views)

Hi Mike

 

I created a test project in which I have a class and a front panel VI, NewTemp.vi (inside a library, NewLibrary). To test the timing of the Open VI reference, I use the test.vi. I open the test.vi and type in the path of the vi, NewTemp.vit and run it. I open the Tools-> Profile->Performance and Memory and I press start before I run test.vi. After running, I click on the snapshot button and see the timings. I then rename NewTemp.vit to NewTemp.vi and check the timings again. 

 

When its just a VI, the timing I see less compared to a VIT. Also, when in LV8.5, this timings are very less. I've attached both versions LV8.5 and LV8.6.

 

Thanks

Vaa San

Download All
0 Kudos
Message 3 of 14
(4,646 Views)

Hmmm... Yes I see the effect you are talking about. I modified your test VI slightly to average a number (1000) of opening/closing cycles and got the following data:

 

As sent to me:

vit = 0.05645;  vi = 0.02774

 

Curious about the effects of the classes and libraries I tried removing them and got slight improvements:

vit = 0.03590; vi = 0.02312

 

Finally I closed the project and ran the test VI by itself:

vit = 0.00737; vi = 0.00337

 

The thing I want to know is why the nearly order of magnitude improvement caused by not having the project open?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 14
(4,626 Views)
The two main differences between a VI and a VIT are that 
  •  VITs are never run, but are templates that generate a VI instance immediately that has all the properties, attributes and limitations of a VI.  A VI on the other hand has only one instance (unless you make it reentrant)
·         A VI generated by a VIT is debuggable just like a VI in that you can trace the execution along the wires. In general, a VIT creates a copy of the VI in memory when you open a reference to it. Creating that copy takes time, which affects performance when doing recursion. That copy is then a standard VI in every sense, except it is not a file. Also, if you don't close these references, they will take up space in your RAM. Reentrant VIs can currently only do real recursion in 8.5 and if they are part of a class. If you open a VIT, you don't open the actual file, but a clone. This way you can open it multiple times. Each time you open it, you get a clone. This is especially useful when you open the VIT with VI Server. VIT's are useful to make an interface window once, and use it multiple times in your program. If the code should run multiple times, but doesn't have a user interface, use reentrant VI’s instead. As far as having the project open, a VI will reload all instances related to the project therefore causing the Vi to load slower. Best Regards,
Juan Galindo
Applications Engineer
National Instruments
Message 5 of 14
(4,614 Views)

Hi Juan & Mike

 

Thanks for answering. I have another question. Does the Open VI Reference take longer in LV 8.6 than in LV8.5?

 

Happy Holidays!

Vaa San.

0 Kudos
Message 6 of 14
(4,574 Views)

Vaa,

 

I have not tested this comparison. Have you noticed a time difference between the two?

 

I don't belive the architecture for Open VI Reference has changed between versions but it is possible.

 

Regards,

Juan Galindo
Applications Engineer
National Instruments
0 Kudos
Message 7 of 14
(4,569 Views)

Hi Juan

 

I see the difference in timings between LV 8.5.1 and LV 8.6. It was taking about 20ms to open one of my VITs in LV 8.5.1 and it takes about 70ms for the same VIT in LV 8.6. Since its a lot of time and also my project is large, I'm not sure if I should just use LV 8.5.1 and not switch to 8.6.

 

Thanks

Vaa San.

0 Kudos
Message 8 of 14
(4,566 Views)

Hello Vaa,

 

 Let me run a set of tests and investigate a little more about this delay. Just to verify, does the delay occur with every single VIT you open in 8.6 compared to 8.5?

 

Regards,

Juan Galindo
Applications Engineer
National Instruments
0 Kudos
Message 9 of 14
(4,505 Views)

Yes. For all the VITs, the LV 8.6 was slower than LV 8.5 in obtaining references thru the Open VI Reference.

 

Thanks

Vaa San.

0 Kudos
Message 10 of 14
(4,487 Views)