cancel
Showing results for 
Search instead for 
Did you mean: 

To More Specific Class or To Variant

SOLVED
Broken_Arrow
Active Participant
Solved!

To More Specific Class or To Variant

Message contains an image

Which one of these methods is preferred for updating GUI? Any performance hit with To Variant?

 

MoreSpecificClass.png

Richard






Tags (3)
10 REPLIES 10
Darin.K
Trusted Enthusiast

Re: To More Specific Class or To Variant

The data I ship through PNs to the UI tends to be small enough that I completely disregard the small hit with the variant compared to the (probably slightly smaller) hit with To More Specific Class.  In fact, I skip the explicit To Variant step and wire the constant straight in.

 

Broken_Arrow
Active Participant

Re: To More Specific Class or To Variant

Thanks Darin. Lately, I've been on a "less bulk" kick - preferring streamlined code to ultimate performance code when ultimate performance isn't required. Of course, writing to PNs implies non-priority code, so no reason to hot-rod.

 

New Top Gear this week BTW.Smiley Wink

Richard






Darin.K
Trusted Enthusiast
Solution

Re: To More Specific Class or To Variant

Message contains an image

Out of curiosity, and for a fellow Top Gear (real BBC version, not lame History Channel knock-off) fan here is some quick benchmarking data:

 

UI UpdateSpeed.png

 

Another case where fear of coercion dots leads to trouble.  Putting in the explicit variant conversion slows things down a bit more than the To Specific Class as I suspected (but did not know).  However, my strategy of plugging the value straight in and living with the red dot helps considerably, as the implicit conversion is as fast as using a Linked property node (laziness pays off, yes!).  Locals just smoke PNs, but we knew that and I just wanted to see with my own eyes.

Tags (3)
Highlighted
Broken_Arrow
Active Participant

Re: To More Specific Class or To Variant

I would not have guessed that the red dot would outperform strict! Thanks for the benchmark. Many VI's 'bout to change.

 

The local is fast, sure, and so would be the global, but that's like using leaf spring suspension on a Zonda, or putting $89 tires on a Gumpert, or putting Clarkson in a diesel Vauxhall --- something's gonna break.

 

 

Richard






JÞB
Knight of NI

Re: To More Specific Class or To Variant

Thank you both!

 

I've had my suspicions about implied coersions (now and then fueled by forum posts) and have never been a drinker of the Kool-aide mantra "Thou Shall eliminate all coersion dots!"

 

On the side- mine are not RED.  They are a hideoius blueish green- just so I cannot overlook the "pretty" red dots- but, I do leave them alone as long as they play nice and don't cause trouble.


"Should be" isn't "Is" -Jay
Knight of NI

Re: To More Specific Class or To Variant

I've heard that drinking lots of Kool-Aid makes you see red dots all over the place.

 

But that might be something else, come to think of it.

Darin.K
Trusted Enthusiast

Re: To More Specific Class or To Variant


@broken Arrow wrote:

I would not have guessed that the red dot would outperform strict! Thanks for the benchmark. Many VI's 'bout to change.

 

The local is fast, sure, and so would be the global, but that's like using leaf spring suspension on a Zonda, or putting $89 tires on a Gumpert, or putting Clarkson in a diesel Vauxhall --- something's gonna break.

 

 


I'd be lying if I said I expected the implicit conversion to be so fast, looks like LV is smart enough to short circuit the number->variant->number cycle.  My rule of thumb seems to hold: get as many operations as possible to take place "under the hood".

 

As to the local, it is similar to my experience with Blackjack.  All of the books and cards will tell you to hit on 16 against the dealer's high card (no surrender), yet I see so many noobs standing or wavering.  Even I would have a small twitch.  Eventually I ran some simulations in LV to quantify the odds, and while yes you are in a bad situation, there is a way to make it worse (stand).  Now there is no indecision at all.

 

When I am running an event structure in a GUI and need to update a control I am faced with a similar choice: local or value property?  Not a great choice, but again there is a way to make it worse (PN).  Now after running some LV tests, I will drop the local without hesitation.  Ironically, many of the avid local-haters do not bat an eye at the Value property.  I guess if it has an error wire it can't be evil.  Smiley Very Happy

Knight of NI

Re: To More Specific Class or To Variant


@Darin.K wrote:
Ironically, many of the avid local-haters do not bat an eye at the Value property.

Don't count me in that group. I've used local variables a lot. Smiley Wink

 


I guess if it has an error wire it can't be evil.  Smiley Very Happy

So this must mean that Express VIs aren't evil! Awesome, everybody go and start coding everything with Express VIs! Smiley Very Happy

Broken_Arrow
Active Participant

Re: To More Specific Class or To Variant

Message contains an image

Darin.K wrote:

[...]

 I guess if it has an error wire it can't be evil.  Smiley Very Happy
evil.png
Richard