08-01-2023 02:30 AM
Is there a way to solve following code section more efficiently? Every time I start the case my program runs only with a fraction of the speed it used to.
The input is a 16 bit integer 2d-array which I then convert in the loop into the corresponding 11 bit binary string. Now I extract the RGB values of this string and let the user manipulate them with a scale.
Then i reverse all the steps and print the 2d array with a resolution of 640x480 pixels on the Image.
08-01-2023 02:58 AM - edited 08-01-2023 02:58 AM
Hi vaiosc,
vaiosc@gmx.de wrote:
Is there a way to solve following code section more efficiently?
Yes!
Whenever you convert numbers to string and back to numbers just to manipulate some bits then there is a simpler way…
Suggestion to get your RGB bits:
08-01-2023 04:30 AM - edited 08-01-2023 04:31 AM
08-01-2023 08:43 AM
vaiosc@gmx.de wrote:
Every time I start the case my program runs only with a fraction of the speed it used to.
Gerd already gave you great advice so listen to him carefully.
Still, I am curious that you said that the same code used to run faster. That is very hard to believe! How did you measure the speed? What was the speed before and after?
As has been said, doing bit manipulations using binary formatted strings and orange(!) math is just really (really!!!) bad!
Some other observations:
When asking for help, you need to attach your VI (preferably LabVIEW 2020 or lower) AND some typical data. This way we can actually test that our solutions give the same result (but are just millions of times faster!). Nobody in his right mind would try to reconstruct the code in your image from scratch, especially since we don't even know the values of the controls (well, we can guess, of course).