03-13-2013 03:31 AM
Hi,
I have the following VI
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
Solved! Go to Solution.
03-13-2013 10:04 AM
Thijs,
This is about ten times faster:
Polymorphism, especially for arrays, can be your friend.
Lynn
03-13-2013 10:51 AM
03-14-2013 02:38 AM
Thanks!
Can you also explain why it is faster? Do you have an article about this? I am very interested!
Best regards,
Thijs
03-14-2013 03:19 AM
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...
03-14-2013 03:48 AM - edited 03-14-2013 03:51 AM
@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.
03-14-2013 05:21 AM
Thank you to GerdW and rolfk for contributing explanations while I was sleeping.
Lynn