Jump to content

Variant vs. flattened string


Recommended Posts

It seems like both variants and flattened strings allow one to pass data in and out of a VI without needing to know what the underlying datatype is. Is there a reason to prefer one over the other in this instance (e.g. speed, memory size)?

There are other applications, I'm sure: Variants have attributes (but I've never really seen the point of those); and TCP communication requires the use of strings. Variants carry with them information about the datatype, but you still need something of the appropriate datatype to use Variant to Data.

Link to comment
Is there a reason to prefer one over the other in this instance (e.g. speed, memory size)?

Variants are better for in-memory usage performance wise. Flattened strings suit better for storing data to disk etc. Variants are also more flexible in many ways. There was some discussion and examples of benefits of variants over typecasting in this thread.

Link to comment
Variants have attributes (but I've never really seen the point of those)

attributes are great - you can have as many as you like, as well as the attribute being a variant itself, which means that you can attach any sort of metadata to a variant. This opens a bunch of opportunities including building architectures around dynamic data streams - they're awesome! (...and fast too ;) )

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.