GoGators Posted March 16, 2010 Report Share Posted March 16, 2010 I was looking for a way to statically call a dynamic dispatch. That or a dispatch once and then reuse many. My use case is that I want to build up a nice hierarchy of inheritance for DAQ devices. During the Acquire method they call their parents methods as well as add their own bit of code. It looks like it is going to work really well except that dynamic dispatch is about 10x slower than static dispatch. Since I'm inside the acquisition loop, the DAQ device is not going to be changing classes. It would be nice to dispatch the method on the first call, and from then on continue to use the same method (thus improving performance). Here is my benchmark VIs to compare the speed of dispatch. Benchmark.zip Quote Link to comment
Yair Posted March 16, 2010 Report Share Posted March 16, 2010 I didn't look at your benchmark, but you could probably implement this yourself by opening a reference to the VI in the relevant class during the first call and then using that reference to run the VI by-ref for all calls. The VI itself will then not need to be DD - you simply need to get the VI's path and open a reference to it. Quote Link to comment
GoGators Posted March 16, 2010 Author Report Share Posted March 16, 2010 I didn't look at your benchmark, but you could probably implement this yourself by opening a reference to the VI in the relevant class during the first call and then using that reference to run the VI by-ref for all calls. The VI itself will then not need to be DD - you simply need to get the VI's path and open a reference to it. That is one possible workaround, but the bonus of DD is that it allows Call Parent method. Without DD it is not allowed thus I can't simply be adding on more and more to the methods. Quote Link to comment
Aristos Queue Posted March 16, 2010 Report Share Posted March 16, 2010 10x slower? No benchmark I've seen shows that kind of slowdown. I won't rule it out (and I haven't looked at your VIs), but that would be... surprising. What version of LabVIEW are you using to do the benchmarking? Quote Link to comment
Jeffrey Habets Posted March 16, 2010 Report Share Posted March 16, 2010 I just ran your benchmark code on LV2009SP1 and indeed see that calling the static method is about 10x faster than calling the dynamic dispatch one. I backsaved to LV8.6 and ran it there, now calling the static method is only 2x faster. Mind you, in both version of LabVIEW the dyn.dispatch was about the same speed, but it seems static calling speed has improved in LV2009. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.