02-18-2018 06:16 PM
Hi Friends,
Solved! Go to Solution.
02-18-2018 06:32 PM
Perhaps you could post the VI(s) concerned - there many be many things that can be altered to increase performance but it will be hard to give the right information without seeing what you have thus far.
02-18-2018 06:56 PM
Hi,
Here is the VI.
02-18-2018 07:19 PM
Unfortunately I only have access to LV 2012 right now and I see that the VI is in 2016.
But I can give some advice. I see that you have color highlighting of your rows in the table which you presumably do programmatically - and are probably doing in the same loop as your "verification" logic. Updating the UI is a relatively "slower" operation and, if its in the same loop as your verification update logic, will slow down your overall throughput. From a bench-marking perspective have you tried removing the UI update part and seen what the difference is?
02-18-2018 07:36 PM - edited 02-18-2018 07:44 PM
A colleague back-saved this VI for me so I have been able to take a quick look. As I suspected you are modifying the Table UI properties inside your loop which effectively reduces your throughput. LabVIEW has to keep making context switches back and forth from the UI thread (significantly increasing the overhead of each loop iteration). Updating the UI is a relatively expensive task for all applications regardless of language - your comparison to SQL Server is a bit like comparing apples to oranges since the server has no UI, just the headless DB engine.
Attached is an updated version with a single change which removes the UI updates out of your tight "verification" loop and instead passes the necessary data onto a separate loop to manage the UI. This reduces the amount of context switching you are performing and improves the throughput of your routines without making any other changes. There are some other improvements you could make (such as defering panel updates to reduce table update flicker and improve the UI thread performance) but this will be the biggest.
EDIT: Added a version with Defer Panel Updates added
02-18-2018 08:28 PM
Very thanks friend, Your code works very very fast!
02-19-2018 05:18 AM
String operations are 'heavy' so moving them outside of the loop makes a big difference. Parallellizing the loop also helps. This modification runs on ~0.3s
/Y
02-19-2018 01:15 PM - edited 02-19-2018 01:29 PM
Out of interest: if we try bechmarking all of the improvements step by step (100 iterations) with debugging disabled; on my 4 logical processor machine @ 2.7GHz the results are:
Your original code:
- With UI shown mean of 8823ms, sigma 118.10ms (@100 iterations this took a while to get!)
- With no UI shown (SubVI closed) mean of 28.48ms, sigma 4.41ms
Just moving the UI updates out of the main FOR loop (my original one):
- With UI shown mean of 70.01ms, sigma 10.10ms
- With no UI shown (SubVI closed) mean of 6.92ms, sigma 1.63ms
Additionally moving the constant logic outside the FOR loop (Yamaeda's addition):
- With UI shown mean of 69.80ms, sigma 10.93ms
- With no UI shown (SubVI closed) mean of 7.79ms, sigma 1.30ms
Additionally setting Parallelisation of FOR loop set to 4 to maximise logical CPU usage:
- With UI shown mean of 71.07ms, sigma 11.93ms
- With no UI shown (SubVI closed) mean of 6.89ms, sigma 0.93ms
This goes to show a few things: