LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Code optimization help.

I have an issue with processing time of the attached code.  The code is developed to change the font color of a text input as needed.  The ColorText.vi is the VI I am having troubles optimizing for speed.  The Main.vi is for test purposes only.  As it stands now the VI takes about 14 seconds on my PC but there must be some improvements that can be made to speed that up.  Any feedback would be greatly appreciated.  

Download All
0 Kudos
Message 1 of 6
(5,056 Views)

I think you're out of luck optimizing the text colorizing loop. You might make more progress reworking your For loop to colorize larger sections at a time, rather than single lines. It also appears that you could do a single For loop rather than two, and do you really need to convert your string to an array and then back to a string again, rather than using the string you start with?

0 Kudos
Message 2 of 6
(5,032 Views)

Try

after the defer FP updat

 

drop a string control property node visable with a false.

 

After the loop that does the color setting use a another visable to make it visable just prior the the undefer.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 6
(5,024 Views)

Alos getting rid of the indicator in the sub-VI and it's property node stuff will help as well.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 6
(5,014 Views)

Thanks for the input, I have tried making the string control not visible during the processing but that did not help reduce the time.  If I set the “Update String Indicator” to false it does speed up the time which is essentially removing the indicators property node stuff.  I was hoping there was some glaring issue with the rest of the code that could be optimized. I suppose I should re-write the function with only one for loop instead of processing with two.   Thanks for the feedback.

0 Kudos
Message 5 of 6
(4,973 Views)

The execution trace toolkit would let you peak behind the curtain but I suspect the bulk of the time is working in the UI thread.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 6
(4,963 Views)