BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

I went through it so quickly that I didn't even notice that you had fixed my original.  Does it help my case to say that that code is almost three years old?  No, I guess not...

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 931 of 2,565
(11,443 Views)

Did you say the code was written by a thre year old?

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 932 of 2,565
(11,434 Views)

Hmmm.. I realized the index array can be replaced with a while loop.

 

untitled.PNG

I wonder which is faster This has 10 nodes compared to the 9 in the first "fix" and 11 in original. 

 

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 933 of 2,565
(11,428 Views)

@LV_Pro wrote:

Did you say the code was written by a thre year old?


Ouch...

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 934 of 2,565
(11,424 Views)

Ok, I'll admit I haven't actually opened and looked at the case structure, but if i remember correctly from my bench marking tests Jeff, while Jim's code may be "Rube'd" it'll run faster than your's. The reason being that a string into a case structure always needs a default case, and LabVIEW seems to take more time to run this than a boolean check and case structure. It seems to check how many cases it has, if the string matches an existing case and then if not, it runs the default case. Jim's code just does a simple boolean check and on long strings, or where you are only looking to match one string (a boolean check). Jim's technique is more effiecient in time and memory in LabVIEW - certainly before LabVIEW 2010.

 

- Not sure if that is a Rube Jeff! Smiley Wink

 

Please feel free to correct me anyone who has actually bother testing this or can remember better!!

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 935 of 2,565
(11,400 Views)

@Jeff Bohrer wrote:

Hmmm.. I realized the index array can be replaced with a while loop.

 

untitled.PNG

I wonder which is faster This has 10 nodes compared to the 9 in the first "fix" and 11 in original. 

 

 

 


What is the benefit of replacing the Index Array with a While Loop?

 

I would have used the index array myself.  Is it indeed a Rube?  Since it is not really adding complexity. 

-curious-

0 Kudos
Message 936 of 2,565
(11,373 Views)

OK the challange involved Jim fearing seeing his latest snippet in the thread.  So I went to his images - I would have posted it in reply WITHOUT regard to any R-G constructs found.  Smiley Very Happy BONUS a compare to constant feeding a case selector WAS found- It may be faster to do so in this instance.  If so Jim RG'd it for optomization and I'll take the knowledge and apply itSmiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 937 of 2,565
(11,365 Views)

Interesting way to see if a boolean array as changed (top of image).

 

It is also not very clear why we need to read the local variable into the output if it is the same as the input array (TRUE case, not shown)

 

 

(Also substituting a local variable for a shift register as suggested is probably not such a great idea!)

 

(seen here)

0 Kudos
Message 938 of 2,565
(11,334 Views)

@altenbach wrote:

Interesting way to see if a boolean array as changed (top of image).

 

It is also not very clear why we need to read the local variable into the output if it is the same as the input array (TRUE case, not shown)

 

 

(Also substituting a local variable for a shift register as suggested is probably not such a great idea!)

 

(seen here)


Because the output and input are not the same until after the vi is executed. I thought about using a feed back node. Two differnt ways to do the same thing.

Tim
GHSP
0 Kudos
Message 939 of 2,565
(11,319 Views)

@aeastet wrote:
Because the output and input are not the same until after the vi is executed.


In your TRUE case, they are the same so there is no need to wire the 1D array across the case structure at all, right?

0 Kudos
Message 940 of 2,565
(11,313 Views)