LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there performance penality calling control property node in a non user interface environement

Hello,

 

I am designing an application with mutliple thread : some processing threads and others user interface thread.

My question is : what happends when I call a property node or invoke node of a control (owned by user interface VI) in a processing thread?

Does the processing thread goes to user interface context? and does it stay into this context?

Does perfromance goes low when doing this? Can processing thread run on an other processor than interface thread?

Is it recommanded to call these nodes only in the user interface thread?

 

thanx for answers.

 

Bye

 

Pierre

0 Kudos
Message 1 of 3
(2,615 Views)

Usually, when you use a property or invoke node, there will be a switch to the UI thread.  But not always.  And that is about the extent of my knowledge.  I usually keep properties and methods in non-time-critical parts of the code, where they will not cause performance issues.

 

If you need to update a front panel control, the fastest methods, in order of speed, are:

 

  1. Write to the terminal
  2. Write to a local variable
  3. Use the VI method Set Control Value (under Control Value » Set).
  4. Write the control property Value.

If you need to continuously update values while processing, and the value update is causing performance issues, consider using a producer/consumer system to update your values in a separate loop from the processing.

0 Kudos
Message 2 of 3
(2,604 Views)

Actually, I am designing an Model View Presenter pattern.

For each graphical Element, there will be :

- 1 vi for presenter event handler : running in processing context,

- 1 vi for view frame and event handler : running in UI context,

During creation, it happends that nodes are called in presenter context just to prepare View controls representation (position, size, panel origin...). That way is easier, and when the front panel is insert into subpanel, it is already cleaned.

 

My fear is about node calling in a top level VI and LV-Runtime context choices for this VI... if context switch occurs only during node calling, it will not be a problem. But if context is defined by the fact that node can be called, it could be sad...

 

Concerning data refresh, data will be shared using references, attached to an "onChanged" event and display directly by View on the terminal when event is generated.

 

0 Kudos
Message 3 of 3
(2,594 Views)