05-04-2022 12:00 PM
I'm aware of how the messages to cloneable modules works (all receive the message, only th addressed module ID acts on it) and the reasons for this design choice. However, I'm finding myself in a situation where I need a cloneable module, but they will be receiving lots of messages in quick succession. I believe the overhead of discarding messages not addressed to the specific module will add up to something detrimental to overall performance one there are a few modules involved. Are there any recommendations for setting up specifically addressed communications between a specific module and the module that launches it? My first thought is to pass a queue reference (or maybe event reference) to the module at startup. Would that work? Is that the "best" solution? Any experiences doing this sort of thing?
05-04-2022 01:22 PM
I don't think there's a single "best" solution, as there are many ways to skin a cat, and an infinite amount of scenarios...
My go-to solution would be a manually created user event(*), probably created by the module starting the clone, and then handing the event reference to the clone via a regular request. The clone can then register for the event, either in the EHL or in a helper loop. You can also hand the reference over via the Start Module.vi, however using a request gives you more freedom in when you provide the reference, or even re-sending the reference...
(*) I like to use user events as that is the default communication paradigm in DQMH. Obviously, you could go with a queue instead...
DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)
05-04-2022 01:36 PM
Just out of curiosity, how many clones do you expect to have and how quickly will you send requests?
On my PC it took about 11us per request, using 100 clones and 1000 requests all addressed to the first clone.
Strangely, if I address the request to all clones (-1) it sends the requests much faster, I'm not sure why.
05-04-2022 03:37 PM
@Gregory wrote:
Just out of curiosity, how many clones do you expect to have and how quickly will you send requests?
On my PC it took about 11us per request, using 100 clones and 1000 requests all addressed to the first clone.
Strangely, if I address the request to all clones (-1) it sends the requests much faster, I'm not sure why.
Well... you may laugh but. It's a UI for a cloneable timer where I wanted the timer/UI separate but also wanted 100th's of a second on the UI refreshing sub 200ms or so. I imagined that a dozen or so modules sending out the value to their cloneable module UIs would get crazy. I didn't test anything or think it through much further (which is a mistake as computers can be unintuitively quick at certain tasks and struggle at others you wouldn't think).
05-04-2022 04:22 PM
A few notes regarding the benchmark VI:
And as for the question why addressing all clones (id = -1) is so much faster? The answer can be found in the cloneable module's "Addressed to this module.vi".
DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)
05-04-2022 04:32 PM
Benchmarking is an art. Darren has a whole presentation on it. You can probably find it on the LabVIEW Wiki somewhere. Worth reviewing before attempting any benchmarking as it is very easy to get it wrong.
05-04-2022 04:34 PM
@Taggart wrote:
Benchmarking is an art. Darren has a whole presentation on it.
Not quite a whole presentation, but slides 13-16 of Brainless LabVIEW.
05-04-2022 04:38 PM
Thanks for supplying the link. I just realized that every time I benchmark stuff I waste a bunch of time looking for that. Now I created a shortcut!
05-04-2022 04:42 PM
@joerg.hampel wrote:And as for the question why addressing all clones (id = -1) is so much faster? The answer can be found in the cloneable module's "Addressed to this module.vi".
Hi Joerg,
But why does that make generating the events faster? Do the modules process the event so much faster that the event queue doesn't have to grow as much?
05-04-2022 05:22 PM
I was quite confident that the difference is coming from the fact that for -1, there's no need to compare or look up the ID... But at second glance, that can't be it! I stand corrected it seems.
I tried with a Request (without reply) and can reproduce your results - without any explanation. Looking at the Event Inspector Window, I can't spot any differences between the two scenarios - but those are tiny timing values I'm looking at so I'm not sure how to quantify any of this.
Sorry!
DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)