LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How are LabVIEW functions are Faster than Custom sub VI 's

For benchmarking, you also should somehow exclude the Control and Indicator (Image in, Histogram). Both will result in at least two additional data copies each.

Of course the same needs to be done for the IMAQ version. 

 

For such benchmarking, using flat sequences is ok. Get the time in the 1st and 3rd frame, place the code inside the second frame. Run the wires from/to the control/indicator inside the first/out of the third frame! 

 

Felix 

0 Kudos
Message 11 of 17
(1,176 Views)

Hi Ppl,

 

I tried dividing the array in to two and run the computation parallel y.   I found that it was actually worse than the previous code. I also tried using the dll approach. I discovered that when we create a exe out this code it gives the same performance as the dll.

 

Thanks, 

0 Kudos
Message 12 of 17
(1,137 Views)

Also some more performance boost: Set the Execution priority to subroutine.

 

Felix 

0 Kudos
Message 13 of 17
(1,122 Views)
Labview is well know for being a memory guzzlerAs an example very few Labview signal processing VIs do have a core written in Labview. Because they would be to slow.  


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 14 of 17
(1,114 Views)

If you chase down the links in the tag for LabVIEW_Performance you will find discusion of the many factors tht can affect LV performance.

 

I have seen and read of people getting performance that rivals the built-in functions and in an old version of LV even beats the built-in but it is rare.

 

If you read through all of those linked messages and spend some time benchmarking you should get good performance, but do NOT expect to beat what NI supplied but my if any.

 

In the above eaxmple there are two issues (at least).

 

1) The memory manager is invoked everytime to allocate the array for the histogram. If the caller created the buffer and passed it in (see the Clear as mud thread), that would improve performance.

 

2) Similarly with the data coming in.

 

So review those linked threads and do some benchmarking.

 

If you find something interesting or suprising post images and benchmark results and let us hob-nob on what you find.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 15 of 17
(1,100 Views)
  • If this is a subVI, make sure it's panel is closed when benchmarking. If you have it open (and it's not set to subVI as suggested elsewhere), it will need to update the control of the huge 2D array, which might be expensive.
  • Disable debugging.
  • How are you benchmarking the performance? Maybe your method is flawed. 😉
  • The I32 conversion does not add anything useful. Leaving the coercion dot might actually be slightly faster.

 

Please attach your actual histogram VI and benchmarking setup. How big is the 2D array.


Ben wrote:

1) The memory manager is invoked everytime to allocate the array for the histogram. If the caller created the buffer and passed it in (see the Clear as mud thread), that would improve performance.


I disagree here. The histogram array is constant and folded at compile time.

(It's also tiny and probably would not be releveant, even if it were allocated every time.)

Message 16 of 17
(1,073 Views)

altenbach wrote:
  • ...

I disagree here. The histogram array is constant and folded at compile time.

(It's also tiny and probably would not be releveant, even if it were allocated every time.)


Yes but that buffer can not be used at run time since the next call of the sub-VI would find the results from the previous run. It SEEMS the constant folded buffer has to be copied to a working buffer in the SR.

 

Just speculating and appreciating your feed-back and in-sight,

 

Ben

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