06-22-2010 03:28 PM
@smercurio_fc wrote:
I like to use a numeric control set to have a default value to the value that I want and then I use a local variable to get the value.
No, not a control!!! Use a hidden numeric indicator instead. 😄
06-22-2010 04:45 PM
@altenbach wrote:
@smercurio_fc wrote:
I like to use a numeric control set to have a default value to the value that I want and then I use a local variable to get the value.
No, not a control!!! Use a hidden numeric indicator instead. 😄
I'd recommend a hidden string control and then using String to value! That way it's general and can always be used!
/Y
06-22-2010 06:20 PM
A couple years ago, I began an "uphill struggle" where I began to become more and more anal retentive about nitpicky details like this one. In some instances, this question is very important! For instance, a very large (bytes) constant inside of a Loop running millions of times. Here, performance is a big issue!
On the other hand, a numeric scalar constant inside a loop running a couple dozen times is of negligible performance hit. Still, I would meticulously try to squeeze the absolute best performance out of every system, many times at the expense of a good-looking diagram.
More recently, I have placed a higher importance on syntactical beauty, yes, even at the expense of a few clock cycles. A good-looking diagram translates to saved time when troubleshooting or revisiting old code. Colleagues will love you. I mean, who wants a spaghetti VI with 19.9994% CPU utilization rather than one that looks good at 20%?
Part of "syntax beauty" also includes consistency. If there are two methods that perform slightly better in different situations (for instance, the "Vestigial For Loop" around an otherwise polymorphic primitive), sometimes it's better just to be consistent than to gain a few clock cycles.
So, bottom line: I always choose what looks best when we're talking about microseconds of execution, but every now and then the obligatory performance benchmark will dictate best practices. The answer to this question is academic, and only becomes practical when there's appreciable performance gain.
06-22-2010 06:22 PM
By the way, good question! My favorite posts are about "best practices", and especially when you get a little humour splashed in!