From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Correct way of using the Variant Get/Replace In-Place Element Structure function?

I did a similar speed test, but I am seeing some strange behavior depending on whether I have indicators shown or not.  You can see the details and the VI I created on this post: 

 

https://lavag.org/topic/19722-lv2016-new-in-place-struct-border-nodes-for-variant-attribute-access/?...

 

 

Director of Engineering
G Systems, www.gsystems.com
Certified LabVIEW Architect
Certified LabVIEW Embedded Systems Developer
Certified Professional Instructor
GCentral
0 Kudos
Message 11 of 13
(1,158 Views)

So I was reminded of this thread and the questions is raised, and I was wondering about the best way to perform a read on a variant attribute, and how the performance varies with the primitive solution.

 

What I found is the primitive for reading variant attributes is consistently faster than the IPE.  One reason for this is that you have to convert the data type to the actual type you want, because the IPE returns the attribute as a variant, where the primitive returns it as the data type you specify.  Attached is my updated speed test with the two reads.

 

Does this mean if you want to just read the data, that you should use the primitive, and if you want to replace, or read/modify/write you should use the IPE?

0 Kudos
Message 12 of 13
(1,029 Views)

I see the same as you Hooovahh, if you just want to read the get variant attribute function is a tad faster than using the in-built structure...which kind of makes sense as you are not really avoiding the cost of having to manipulate the attribute content of the variant..For anything that involves changes to the attributes, he in-place structure is the best solution.

0 Kudos
Message 13 of 13
(1,005 Views)