01-30-2025 03:28 PM
I have a loop that's gathering data quickly and another loop that wants a snapshot of loop1's data, will do some processing on that data, and show the latest status. My goal is to minimize the disruption to loop 1 and only send occasional snapshots of the data to loop2.
What's interesting is that even if I leave the boolean false so that the empty case runs (I don't send any copies to loop2), the empty structure still requires significant processing time. Is this an optimization that isn't working for me? Is there a way to control the behavior more to what I'm looking for?
01-30-2025 03:59 PM
Modifying the value of the map is what is taking up the most time. If you wrap that in a diagram disable structure it executes almost instantly.
01-30-2025 04:16 PM - edited 01-30-2025 04:17 PM
Well, it only measures the elapsed time between the outer frames, so the map generation should not matter.
Of course it is highly unlikely that two random numbers ever repeat, so that map grows very quickly, probably stealing a lot of CPU from the rest of the diagram to manage its data in parallel of running the sequence. Once you make duplicates more common, things speed up.
(e,g the following will limit the map size to 100 entries and everything is fast.)
I also recommend the high resolution relative seconds for the timing.
01-30-2025 05:14 PM - edited 01-30-2025 05:22 PM
@Gregory wrote:
Modifying the value of the map is what is taking up the most time. If you wrap that in a diagram disable structure it executes almost instantly.
Surprisingly, the empty case structure takes 45 seconds of processing on my PC and the insert/increment code takes 0.05 seconds.
01-30-2025 05:20 PM - edited 01-30-2025 05:20 PM
@altenbach wrote:
Well, it only measures the elapsed time between the outer frames, so the map generation should not matter.
Of course it is highly unlikely that two random numbers ever repeat, so that map grows very quickly, probably stealing a lot of CPU from the rest of the diagram to manage its data in parallel of running the sequence. Once you make duplicates more common, things speed up.
(e,g the following will limit the map size to 100 entries and everything is fast.)
I also recommend the high resolution relative seconds for the timing.
Yes, that was somewhat intentional. In my real use case, I have a lot of bins so I know it's going to take some time to make the "copy" which is why I wrapped it in a case structure. I had the intent of only occasionally enabling the "copy". My loop1 can tolerate an occasional long iteration but it needs to usually run fast.
01-30-2025 05:50 PM
@nanocyte wrote:
@Gregory wrote:
Modifying the value of the map is what is taking up the most time. If you wrap that in a diagram disable structure it executes almost instantly.
Surprisingly, the empty case structure takes 45 seconds of processing on my PC and the insert/increment code takes 0.05 seconds.
I think you've got those backwards
01-30-2025 06:04 PM
@Gregory wrote:
I think you've got those backwards
Nevermind, I think I saw something similar before my VM crashed, haha
01-30-2025 07:02 PM
I saw very little difference between the true and false case.
01-30-2025 07:07 PM
That's what I'm confused about. The false case is empty. It should be very fast.