Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚡ Add concurrency to logic block body #88

Closed
rneswold opened this issue Jun 30, 2023 · 2 comments · Fixed by #116
Closed

⚡ Add concurrency to logic block body #88

rneswold opened this issue Jun 30, 2023 · 2 comments · Fixed by #116
Labels
difficulty:hard Issue will be a challenge to complete enhancement New feature or request logic-block Issue is about logic blocks

Comments

@rneswold
Copy link
Contributor

The main loop of a logic block body is

  • Wait for a new value from any input device
    • Save the value
    • For each expression
      • Evaluate it
      • If a value is computed, send a setting to the target device

The problem is that any generated settings are serialized. This loop should build a vector of futures that send the setting and, after all expressions have been processed, resolve the vector of futures at once. If one target device is a little slow, it won't necessarily slow down other devices.

(Of course, this only improves the behavior of logic blocks that have more than one expression.)

@rneswold rneswold added enhancement New feature or request logic-block Issue is about logic blocks difficulty:easy Issue should be easy to fix labels Jun 30, 2023
@rneswold rneswold added this to the Release v0.4.0 milestone Jul 3, 2023
@rneswold rneswold added difficulty:hard Issue will be a challenge to complete and removed difficulty:easy Issue should be easy to fix labels Sep 10, 2023
@rneswold
Copy link
Contributor Author

Turns out this is more difficult than I thought.

I tried to build a vector of futures which could be run concurrently, but couldn't fix the compile errors. In order to send the outgoing settings, the vector of futures captured some data from self. I think the core of the run() method needs to refactored. Maybe the output channels need to be stored as local variables of run() instead of instance fields of Node?

@rneswold rneswold changed the title Add concurrency to logic block body ⚡ Add concurrency to logic block body Feb 12, 2024
@rneswold rneswold added the blocked Issue can't proceed label Apr 19, 2024
@rneswold
Copy link
Contributor Author

This issue is blocked until #89 is finished. There's a risk that, if this was completed first, it would need further work once the other issue was completed.

@rneswold rneswold removed the blocked Issue can't proceed label Jul 20, 2024
@rneswold rneswold mentioned this issue Jul 22, 2024
@rneswold rneswold linked a pull request Jul 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty:hard Issue will be a challenge to complete enhancement New feature or request logic-block Issue is about logic blocks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant