Jump to content

Statically calliing a dynamic dispatch


Recommended Posts

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

Link to comment

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.

Link to comment

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.

Link to comment

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.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.