08-21-2023 05:22 AM
wiebe@CARYA wrote:
This would be faster than both the not and the add on the variable input.
The not on the constant will be constant folded...
You assume that "Not(X OR Y)" is an atomic operation. Is it?
08-21-2023 06:06 AM - edited 08-21-2023 06:09 AM
@altenbach wrote:
wiebe@CARYA wrote:
This would be faster than both the not and the add on the variable input.
The not on the constant will be constant folded...
You assume that "Not(X OR Y)" is an atomic operation. Is it?
I can't tell for sure. Studying the DIFR and LLVM was 'inconclusive' (I soon gave up).
If it isn't an atomic operation, I'd put my bet on 2 LabVIEW nodes to be being slower.
Yet again, (if it isn't an atomic operation,) there is a change (with debugging off) LLVM will optimize the code to pretty much the same (a not\or vs or\not).
Either solution will be orders of magnitude faster than the 2 divides and the rest of the original mess.
The real CPU and memory hog is that each box sets the pen, even if the pen doesn't change. If you're drawing (an array of) boxes with the same pen, make a rect function without the pen, and set the pen once. Most picture control functions do this (set the pen every time), and it's horribly slow. The state of the pen will be kept, so you can draw boxes, lines, polylines, etc. with the same pen set just once.
08-21-2023 07:54 AM - edited 08-21-2023 07:56 AM
We are really getting into esoteric landscape here. An NOT OR could be a more complex execution than a simple AND so there is that! How that may or may not differ on a certain CPU architecture under a certain predicting branch execution, with a certain out of order pipeline execution, etc. etc. is an entire study in itself (and generally very irrelevant).
08-21-2023 08:11 AM - edited 08-21-2023 08:24 AM
@rolfk wrote:
(and generally very irrelevant).
Yes, especially in this context.
Building those strings will be so much slower, probably even compared to the original code.
Makes me think about Ernst Heinrich Weber (Wikipedia). You start with RG, and won't bother with the tiny details. But when all the RG is gone, every tiny detail seems to make a relevant change (but doesn't).
08-24-2023 09:24 AM - edited 08-24-2023 09:27 AM
wiebe@CARYA wrote:
Since performance differences are irrelevant, I would always go with more readable code. I argue that mine (top) is easier to comprehend by just looking at it while that double negative (bottom) is somewhat of a brain twister and is more likely to need a diagram comment. 😄
Of course in the example above (draw rectangle), there is more code around it to generate the four output values from six inputs raising the possibility of more global optimizations. I could think of eliminating the case structure because the FALSE case is identical to the TRUE case in half of all possible scenarios! I always prefer flat code where nothing is hidden in other cases of case structures! 🙂
08-24-2023 10:18 AM - edited 08-24-2023 10:22 AM
@altenbach wrote:
I always prefer flat code where nothing is hidden in other cases of case structures!
Here's how that could look like... 😄 (Yes, performance considerations are irrelevant :D)
Or even....
10-26-2023 10:08 AM - edited 10-26-2023 10:10 AM
Who needs data wires when we can do everything (everything!!!) with reference wires??? no need to connect any controls or indicators, we just declare them on the left as "variables".
Lets have a look at this youtube example.... (mentioned here earlier)
(Well, the front panel looks nice and it seems to work...)
10-27-2023 02:14 AM
I'd assume a lot of those controls should be in clusters on the front panel, so you'd only get 1 reference.
But if you want to go that route (it is more or less the only way to get re-useable user interface code), why use clusters?
If you put those references in classes, you can relate the front panel 'objects' with their methods and properties, and then it starts to look like a design method.
11-17-2023 09:35 AM
I am sure the compiler will simplify this behind the scenes, but why clutter the diagram with senseless NOOPs? (seen here)
12-01-2023 11:33 AM - edited 12-01-2023 12:52 PM
If you really (really!) like converting to dynamic data and back, here's what you should do (seen here)
Especially that NOOP going from 1D array to dynamic data and back immediately to the same(?) 1D array. Of course we cannot really tell from the picture, because the conversion configuration could be unusual... 😄 )