LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

optimization for conversion

Solved!
Go to solution

Hi,

 

I have the following VI

Optimization needed.png

 

It runs fast enough on a fast PC (duo core 2) but it doesn't run fast enough on my laptop. Is there a way to optimize this?

 

Best regards,

Thijs

0 Kudos
Message 1 of 7
(2,620 Views)
Solution
Accepted by topic author ThijsBoeree

Thijs,

 

This is about ten times faster:

 

24-bit faster.png

 

Polymorphism, especially for arrays, can be your friend.

 

Lynn

 

 

 

Message 2 of 7
(2,601 Views)
Oke, i'll see it tomorrow, i am on my way home now...
Best regards!
Thijs
0 Kudos
Message 3 of 7
(2,594 Views)

Thanks!

 

Can you also explain why it is faster? Do you have an article about this? I am very interested!

 

Best regards,

Thijs

0 Kudos
Message 4 of 7
(2,574 Views)

Hi Thijs,

 

it's faster because:

- it uses polymorphism of the "Split Number" function to work directly on array data

- thus the compiler may use some SSE optimization (?)

- it doesn't use a BuildArray node as your version: the appending output tunnel of your FOR loop is nothing else than a shift register with a BuildArray node as was used for the purpose in older LV versions...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 7
(2,568 Views)

@GerdW wrote:

Hi Thijs,

 

it's faster because:

- it uses polymorphism of the "Split Number" function to work directly on array data

- thus the compiler may use some SSE optimization (?)

- it doesn't use a BuildArray node as your version: the appending output tunnel of your FOR loop is nothing else than a shift register with a BuildArray node as was used for the purpose in older LV versions...


I think that the main factor here is the avoidance of a Build Array node inside a loop by using the Interleave 1D Array node instead. Anything else might or might not add a few microseconds to the mix. Could be easily tested by removing the Build Array Node in the original VI and creating three 1D arrays on the loop boundary, then use Interleave 1D Array to combine them together. Certainly the speed difference is then much smaller and probably almost nihil.

Rolf Kalbermatter
My Blog
Message 6 of 7
(2,565 Views)

Thank you to GerdW and rolfk for contributing explanations while I was sleeping.

 

Lynn

0 Kudos
Message 7 of 7
(2,546 Views)