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

Change value/calc/update behavior of nodes. #11

Open
tiborpilz opened this issue Jun 4, 2019 · 0 comments
Open

Change value/calc/update behavior of nodes. #11

tiborpilz opened this issue Jun 4, 2019 · 0 comments
Assignees

Comments

@tiborpilz
Copy link
Contributor

Currently, BaseNode.value is implemented using a getter() property which in turn updates the node via the call() function (which in turn uses the calc() function).

This results in updates when they aren't needed, as everytime the value of any node is accessed, not only does the node recalculate it's current value, but the node's parent values are also accessed and recalculated.

Also, reasoning about the update behavior and when exactly a node's call function is being used is getting complicated.

To alleviate this, BaseNode.value (or BaseNode.output.value) should be a simple property that is being updated by the node when it's recalculating. This way it is clear when the node should compute its output and when it's just being read.

One thing that needs to change is that the computation flow.
Currently, it's starting at the final output node, which is calling it's connected input nodes which are calling their inputs etc.

One possible solution would be to trigger a computation in every node's connected output nodes on update. This might trigger unwanted behavior in nodes with side effects though, as they are being implicitly called.

Another solution could be to mark any descendant nodes with a 'dirty' attribute on computation, and to recalculate any ancestor nodes that are dirty on call.

@tiborpilz tiborpilz self-assigned this Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant