Jump to content

Performance of execution


Recommended Posts

Hi!

I am beginner with LV. I want to know the difference between a "Value" Property Node of an indicator (integer, double or other) and a local variable pointing on this same indicator. Is there a difference in terms of performance??

Is there one solution to prefer??

Well cocowk,

very good question for a beginner. I'm not sure how much is the difference but if you dig into the NI Forums you will find major discussions on this issue.

For a quick start you could measure it yourself. Write 10000 times to a local and 10000 times to a property node and measure the time in between.

Ton

Link to comment

Here's a quick demo VI to show the difference. This isn't actually the best way to do this because they are fighting for processor time when all three are running, but you'll get the idea.

In general, ALWAYS wire directly to the terminal when you can. If you have to update the value from somewhere else or need to write to a contrl, you should use a Local Variable. You should only use a Property Node>Value if you have to change some other property of the control/indicator. No use in taking the hit for the property node than the hit (though not much of one anymore) for the local.

The artical linked above is a good explaination of what is going on in the background.

Ed

Download File:post-47-1144765353.vi

Link to comment
Hi!

I am beginner with LV. I want to know the difference between a "Value" Property Node of an indicator (integer, double or other) and a local variable pointing on this same indicator. Is there a difference in terms of performance??

Is there one solution to prefer??

Well on my machine i updated an I32 in a for loop 100000 times , the results :

updating the terminal : 0.00021 Seconds

updataing via local : 0.00032 Seconds

updating via Value Property 0.25845 Seconds

Dan

Link to comment
Here's a quick demo VI to show the difference. This isn't actually the best way to do this because they are fighting for processor time when all three are running, but you'll get the idea.

In general, ALWAYS wire directly to the terminal when you can. If you have to update the value from somewhere else or need to write to a contrl, you should use a Local Variable. You should only use a Property Node>Value if you have to change some other property of the control/indicator. No use in taking the hit for the property node than the hit (though not much of one anymore) for the local.

The artical linked above is a good explaination of what is going on in the background.

Ed

Yes I know that it is better to link directly to the terminal, but it's not possible in my case. That's why I asked the question :laugh:

Thanks for all your advices. I didn't have the idea of testing this way...

coco

Link to comment
Here's a quick demo VI to show the difference. This isn't actually the best way to do this because they are fighting for processor time when all three are running, but you'll get the idea.

In general, ALWAYS wire directly to the terminal when you can. If you have to update the value from somewhere else or need to write to a contrl, you should use a Local Variable. You should only use a Property Node>Value if you have to change some other property of the control/indicator. No use in taking the hit for the property node than the hit (though not much of one anymore) for the local.

The artical linked above is a good explaination of what is going on in the background.

Ed

I have always been curious about this but I don't have any pressing cycle time issues so I never worried about local versus prop node. Truth is I use prop nodes almost eclusively to change values, mostly boolean indicators, if that makes a difference. I realize that I will miss the error in and out if I start using locals.

Mike

Link to comment
mostly boolean indicators, if that makes a difference.

Mike

The type of control/indicator does not make a difference. They are all treated the same.

If I do need to use a property node from some reason, I always set it up so that it is only written to when it needs to be. This way you get the overhead hit when needed instead of every iteration of the loop.

Ed

Link to comment

This topic made me curious, so I added a couple of new tests to the VI in LV8. These are the results I got:

Property Node: .229 sec

Local: .004 sec

Direct: .002 sec

Shared Variable: .004 sec

Global Variable: .005 sec

Plus, the shared variable lets you use error in/out flow control... :)

Note that I did not test network shared variables.

Joe (orko)

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.