LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
ouadji

Time to call a dll !!!

Status: Declined
Issue was resolved in comments below

Below, just an example that uses the "mean function".


This function uses a call to a dll.


Look at the difference between the execution times !

 

This is just a small example to show the extreme slowness of dll calls


The time required to call a dll is a disaster!

 

 


                  please, It would be necessary to improve time to call a dll, really !

 

 

 

SR1.png

 

sorry for my bad english, i do my best Smiley Happy

20 Comments
Darin.K
Trusted Enthusiast

I do not buy the benchmarks (indicators, loop invariants, parallel operations). I compare G to C with each version using Ramp.vi (dll) and while the gap is closing, dlls are still slightly ahead on my systems.  I do not see any disasters.  There is overhead, but nothing like I see with .NET for example. 

altenbach
Knight of NI

Please start a regular thread and post your benchmark code. My guess is that the second code is artificially fast due to constant folding and thus not a valid reference point. This needs to be discussed in detail elsewhere.

Mads
Active Participant

I benchmarked the two alternative approaches without all the disqualifying code (indicator updates etc.) - and they are 100% (!) equal.

 

Example from the benchmarking:

Averaging an array of 100 000 random numbers 10 000 times will take a total of 1076 ms on my machine (107,6 us per run), regardless of which solution is used. 

ouadji
Trusted Enthusiast

@Mads :

I removed indicators, but the results and the difference do not change. (i don't understand)

 

@altenbach : please start a regular threa

Intaris
Proven Zealot

Replace your array constants with controls with the default data set to what you want and try again.

ouadji
Trusted Enthusiast


"Replace your array constants with controls"

 

no change !   Smiley Frustrated

 

 

SR3.png

Intaris
Proven Zealot

Does your mean VI have debugging active?

ToeCutter
Active Participant

+1 Intaris. Also, stick a local variable referencing the control in the loops as the input to the test functions. This will add another read into the loop which is not what you're trying to benchmark, however it will ensure that the compiler is not cleverly figuring out all 100,000 answers are the same in the second loop and taking a shortcut.

ouadji
Trusted Enthusiast

yes ..

 

but with "allow debugging" : OFF ...... no change, same result. (1297ms vs 9ms)

KathrynB
Member

It is constant folding - and the fact that you've got a subVI call in there - try putting your VI mean into a subVI - just the mean and running it again - that way the benchmarking VI shouldn't try to be helpful and only run it once (as I've commented in your post in the regular thread) - because what I'll bet your seeing is that the top loop is actually running 10000 times, and the bottom loop isn't - the compiler has noticed that you are running the SAME code 10000 times (the constant folding) and it isn't going to waste time and energy doing that.