From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Performance slow and erratic

I see nothing in that code that should be an CPU-load concern.

 

Over 1000 calls for a total of 46.7 msec ain't bad.  The fact that the 1 longest call took 33.7 means the other 1000+ *more typical* calls actually only took 13 msec.

 

The rest of it is the kind of thing I just chalk up to Windows being Windows.  It simply isn't uncommon to see occasional timing variations in 10's of msec, sometimes more.   Nature of the beast, that's my conclusion.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 11 of 16
(495 Views)

The variance you are seeing is likely the first iteration. The rest probably runs at far below 1 ms. 

 

Measuring performance is really tricky. There are many threads in the forum about it. I would also suggest you run it in runtime and add some performance measurement timers, since that is a whole other story and it is probably not interesting or even indicative what you are seeing in the IDE.

Certified LabVIEW Architect
0 Kudos
Message 12 of 16
(483 Views)

How often is the GUI being updated?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 13 of 16
(478 Views)

You did not take my suggestion for processing the messages. Don't dequeue the elements individually in a loop (with an arbitrary 5 ms delay in it) but dequeue ALL of the elements at once using a queue flush. The flush has the option of returning all of the elements in the queue at once. Then process elements in a for loop with auto indexing.

 

Try the following:

 

Consumer loop-may.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 14 of 16
(463 Views)

"... a loop (with an arbitrary 5 ms delay in it)..."

 

Again at what rate is the UI being updated?

 

5ms >>> 200 updates a second is silly when the display can not update that fast.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 15 of 16
(462 Views)

@Ben wrote:

"... a loop (with an arbitrary 5 ms delay in it)..."

 

Again at what rate is the UI being updated?

 

5ms >>> 200 updates a second is silly when the display can not update that fast.

 

Ben


The arbitrary delay was in the loop dequeuing the elements from the queue and formatting the elements into a string. There was no UI interaction in the consumer loop. It did write to a global which indicating the line count in the log file but there was no UI in the consumer. 

 

When building a string to write to file there is no need to have a Wait within the loop building the string.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 16 of 16
(457 Views)