LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why wouldn't you use an in place element structure?

If using an in place element structure, in some cases, increases memory and VI efficiency, why wouldn't you use it every time? What are the cases in which it does and doesn't increase memory and VI efficiency?

0 Kudos
Message 1 of 7
(738 Views)

In almost all cases, the compiler can optimize the code perfectly for any possible inplaceness, even without that structure.

 

(I mostly prefer to use the IPE structure to organize certain code constructs.)

0 Kudos
Message 2 of 7
(690 Views)

It is also a blocking function (unless you are using parallel reads)...  While you are manipulating the in-place, no one else can get at the data.  For example, this could be REAL bad.

 

inplace example.png

 

0 Kudos
Message 3 of 7
(677 Views)

A DVR is a very special edge case for an IPE. I think the question was more general. There are many more common modes. (My typical use is for array index, un/bundle, and maps)

 

altenbach_0-1734020764490.png

 

 

Of course a DVR needs to protect from concurrent access, but you can configure it to allow parallel read only access.

0 Kudos
Message 4 of 7
(667 Views)

The IPE can result in cleaner code, for example here's code to make a simple histogram. I am sure that under the hood, the binary code is near identical but the IPE avoids diagram clutter and crossed wires.

 

altenbach_0-1734021349825.png

 

One of the drawbacks is that all indices need to be wired, complicating things, especially at higher dimensions. That's why the following ideas exists!

 

Provide-good-defaults-for-unwired-indices-of-the-array-index

Allow-unwired-index-for-Array-Index-Replace-Elements

... and a few newer duplicates...

 

 

 

 

 

 

0 Kudos
Message 5 of 7
(646 Views)

@dakotasmith2 wrote:

If using an in place element structure, in some cases, increases memory and VI efficiency, why wouldn't you use it every time?


It's (a little) more work to create.


It's cleaner in some cases, but a big mess in others. E.g.:

  • if you replace class data it's faster, but often you end up needing the class to DD a method...
  • Unbundle \ Bundle elements is fast, but if some items only need an unbundle, it might get less efficient. But less clear for sure (IHO).

@dakotasmith2 wrote:

What are the cases in which it does and doesn't increase memory and VI efficiency?


Nobody knows exactly... There are optimizations from the Heap to DFIR, and from DFIR to LLVM and from LLVM to binary... It's complex.

Message 6 of 7
(641 Views)

I sometimes use a naked IPE as single frame flat sequence substitute. It looks nicer, still enforces dataflow, and prevents me from ever adding frames. 😄

Message 7 of 7
(636 Views)