01-04-2013 08:55 AM
I am trying to understand, why is changing the variant is slower, if it is a private variable of a class and how can I fix it.
If setting the attributes directly, the operation of 1000 items takes only about 4 ms.
Extracting the part with variant access into a subvi causes a slow down to 1000 ms. Inlining this sub VI speeds up to about 7 ms.
The same procedure through a class method takes about 1100 ms, quite the same as non-inline-subVI.
But as long as it is not possible to make class methods inline, the access through a class will be that slow?
(Example below: Run Testbench.vi)
01-08-2013 08:56 AM
Hi,
as you already mentioned the inlined version speeds up the VI execution,
which is unfortunately not possible for class methods.
Do you want to use OOP in your project and this combined with the variant type?
Could you describe in detail what you have to do in your LabVIEW project?
Thanks a lot.
Andreas K
NI Germany
01-08-2013 12:08 PM
I did some experimenting and the additional overhead that you're seeing with the class implementation seems to be related to the dynamic dispatch class VIs (GetValue.vi and SetValue.vi). Each time one of these dynamic dispatch functions is called, there is overhead associated with determining the correct class implementation. If these functions don't need different implementations in child classes, then you should make them static dispatch instead. Doing so makes the timing comparable to your variant implementation.
01-09-2013 03:31 AM
I'm using variant based dictionaries to store the configuration parameters for our simulation service tool. Using those dictionaries instead of clusters brings a lot of flexibility (and unfortunately higher execution time).
There are two speed ups I've figured out so far: Using static dispatch for class methods (I don't know if LV is kind of serializing and deserializing variant data when using dynamic dispatch) and changing the execution priority of the method vi to subroutine.
01-09-2013 07:58 AM
There are a few issues here.