08-01-2023 10:34 AM
It has been my practice to not send data through a loop or VI unless the loop or VI modify the data. Although, sending stuff through "looks" better, makes wiring cleaner, and apparently "does no harm".. or does it? What's worse, branching or tunnels?
Long story short, I have to make code that it easily read by novices and non-coders. With that in mind, they'd like B best. I like C (set for Parallelism if possible) but they'd hate it. Which one of these is "best" in terms of data copies, compiler optimization, etc?
Solved! Go to Solution.
08-01-2023 10:41 AM
Most likely the compiler will recognize loop invariant code and optimize it out, making sure that data dependencies are not changed.
SO: It does not matter.
08-01-2023 10:46 AM
@altenbach wrote:
Most likely the compiler will recognize loop invariant code and optimize it out, making sure that data dependencies are not changed.
SO: It does not matter.
Thanks, I had a hunch. Apparently things have gotten better since 5.1 😆
08-01-2023 11:29 AM
I would (almost) always choose clarity over efficiency. I would make exceptions if speed were critical, such as a time requirement - common with high-speed production - or if code clarity made a hugely noticeable lag. Were I to make a video game, for instance, I would optimize for speed wherever I could...