LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best practices for data representation

I'm curious about the best data representation for a constant or variable when there is an obvious choice of two.

For example, take the Timeout terminal of the Event structure. This terminal takes a Long (I32) data type, but I'm wiring to it a constant value of 100 and therefore could use an Unsigned Byte (U8). Setting the constant to be I32 prevents an automatic conversion step from happening, but setting it to be U8 saves a little bit of unnecessary allocated space.

Which is better?
0 Kudos
Message 1 of 3
(2,449 Views)
Hi.. The real question is, would you (do you) notice a difference in your application? There are numerous places in my applications that automatic conversions like that occur (judging from all the extra black dots I see on some of my numeric inputs). I notice no discernable difference in performance. Chances are, you are doing much more expensive things with your block diagram. Based on that, if I had to vote, I'd vote U8 and save a wee bit of space, but that is likely insignificant unless you are really taxing your system. Are you?

Brian.
0 Kudos
Message 2 of 3
(2,443 Views)
Practically speaking it more than likely will not matter until the data sets get large however as a "best practices" go it is best to keep the data consistent and in the type that the control, property node etc expects. Directly from the NI user manual (LV 7.1)

"Coercion dots appear on block diagram nodes to alert you that you wired two different numeric data types together. The dot means that LabVIEW converted the value passed into the node to a different representation. Coercion dots can cause a VI to use more memory and increase its run time. Try to keep data types consistent in VIs."

Cheers,

--Russ
Message 3 of 3
(2,439 Views)