LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When to use DVR?

I just learned about DVR while watching a CLA practice test yesterday.  I totally understand why it's used.  However I don't understand where it is clear that I should use it.  Should I use it for all datas that have multiple read and writes?  Should I use it for all data in general?  What triggers a veteran LabVIEWer to say "this should be DVR"

----------------------------------------------------
Studying for CLA.
LabVIEW, inherit from social media habits!
0 Kudos
Message 1 of 9
(3,668 Views)

I'll think about using DVRs if I need to share the same data space between parallel sections of code.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 9
(3,654 Views)

@Jacobson-ni wrote:

I'll think about using DVRs if I need to share the same data space between parallel sections of code.


I typically use an Action Engine for sharing data.  But for "large" data sets, going with a DVR is more efficient, at least from benchmarks I did back in 2016.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 9
(3,632 Views)

The specific instance I was thinking of when I wrote my first response was launching some asynchronous process and giving it a DVR on startup.

 

I usually think of Action Engines as operating on data where DVRs are really just sharing data.

Matt J | National Instruments | CLA
0 Kudos
Message 4 of 9
(3,611 Views)

Using it for a variable that has the possibility of being loaded with a large data set seems to be the clear use case then.  I had seen it used once before for this as well.  

 

Does it make sense to use DVR for a cluster with many data types inside it? (regardless of whether or not there will be large arrays of data added to the cluster).  Say a cluster of every front panel control.  I guess I am trying to figure out if it is a waste of time to overuse DVR outside of large data sets.

----------------------------------------------------
Studying for CLA.
LabVIEW, inherit from social media habits!
0 Kudos
Message 5 of 9
(3,577 Views)

Without knowing anything about your application I would start by asking myself if there is a reason why just keeping the data in a plain LabVIEW wire won't work.

Matt J | National Instruments | CLA
Message 6 of 9
(3,569 Views)

I like that answer, so DVR isn't necessarily the elite/mandatory default programming method to do in a CLA test.  For example an Elevator likely doesn't need to store much data and DVR isn't necessary.  Then again maybe memory is very small on the elevator.  Either way, I think I've got what I came here for, that is sentiment for DVR.  Has great uses, but not a mandatory staple.  

----------------------------------------------------
Studying for CLA.
LabVIEW, inherit from social media habits!
0 Kudos
Message 7 of 9
(3,554 Views)

I'd recommend not to use DVRs, unless unavoidable.

 

They seriously change your development experience. Especially testing becomes a lot harder. You can't open a sub VI, stop your main, and test the sub VI. The DVR died, because the top level VI stopped running. So, the sub VI's DVR reference isn't valid anymore. Probes are also useless.

 

I started using them but, for me, they caused more problems than they solved. I refactored all of them out, except one. That one apparently is needed, because the by value solution creates a copy of my data, that hurts performance (it's a lot of data).

 

To me, that is the only use case. If you can't get LV to not make copies (of expensive data) with a by value solution. I personally spend a lot of time to avoid that, before turning to a DVR...

 

 

Message 8 of 9
(3,516 Views)

The reason you're seeing value in large data sets is because of what happens when you allocate a new buffer.  The DVR is a few bytes.  The data is whatever size the data is.  Split a wire and you're making data copies, eating up memory, etc.

I'd echo other posts here saying you're likely not needing to use DVRs.  You should be aware they exist.  If you don't have a valid argument to use them in your application, you shouldn't be replacing other code with them just to feel "elite" so to speak.

Message 9 of 9
(3,472 Views)