06-16-2018 08:44 AM
Not sure this helps the Variant overhead, as a variant is, I believe, a description of the data plus a pointer to the data. There's no copying of large data required, so your DVR in a Variant is just as big as a giant array in a Variant.
So far in my cases, according to the Windows Task Manager and various LabVIEW profiling tools, the variant just contains the reference which I believe is a U32 number. Similar to type-casting the reference and then send a U32 around.
mcduff
06-16-2018 01:51 PM
And a pointer to a giant array is also a 32-bit number. "Moving" data only involves a 32-bit pointer unless the compiler believes a copy needs to be made. You should be worrying about copies, not variants.
06-16-2018 03:17 PM
Sorry I wasn’t clear in the last post. I was trying to say in my experience if you take a dvr reference and cast it into a variant the compiler does not copy the associated data with the dvr, on the 32 bit reference number.
mcduff
06-18-2018 02:18 AM
@mcduff wrote:
Not sure this helps the Variant overhead, as a variant is, I believe, a description of the data plus a pointer to the data. There's no copying of large data required, so your DVR in a Variant is just as big as a giant array in a Variant.
So far in my cases, according to the Windows Task Manager and various LabVIEW profiling tools, the variant just contains the reference which I believe is a U32 number. Similar to type-casting the reference and then send a U32 around.
Moving will just move a pointer. A copy is expensive.
The mere overhead of the to\from variant can add up. I won't be too worried about that until it proves to be a problem.
The biggest problem with variants is that you get run time errors, while you really want compile time errors.
06-18-2018 05:53 AM
wrote:
The biggest problem with variants is that you get run time errors, while you really want compile time errors.
@mcduff, please add bad readability of the code in your list of biggest problems with variants.
In some cases variants are the best. However I did not see many of such cases.