Jump to content

Calculate Mean Value of Array (lvanlys vs native)


Recommended Posts

I'm just going to throw this out there...

Capture1.PNG.3452f28e3ed83affba758bfd4a90608a.PNG

LabVIEW's included mean value of array function calls and external dll (lvanlys). It takes close to twice as long (depending on array size) to execute than just doing a native sum of array elements then divide by array size.

Is there any advantage that the lvanlys function has over this simple native mean?

Why aren't most of the lvanlys functions implemented as native LV code instead of a dll? I'd imagine that we could get some performance boost on some of them by using inlining, VIMs, and parallelized loops.

Mean Value Test.vi Mean Value Test SGL.vi

Link to comment
9 hours ago, Antoine Chalons said:

The lvanlys will return an error code if there is a NaN in the array

I couldn't get it to return a non-zero error code. I tried Inf and NaN in the array.

8 hours ago, Lipko said:

Maybe lvanlys uses the cumulative average method

Dividing once for each element feels expensive. It doesn't seem like lvanlys uses it either. Both the native "dumb" mean algorithm and lvanlys overflow around the same value. Whereas a divide at each element algorithm can handle higher values.Capture3.PNG.988852f2b44009128bb6d747e4f9da51.PNG

Mean Value Test.vi

Link to comment

It looks like the external dll call has an extra buffer allocation, don't know if it is real or not, just what NI is reporting, whereas, the native implementation does not. See below. That may account for the speed difference.

image.png.c8cd16e3764702fe5445d2ae78557d8a.png

 

image.png.009c41df37bab1ac97769479cb63d7a0.png

 

EDIT: Execution Trace toolkit shows the same.

Edited by mcduff
Addition
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.