Move default socket properties to update system #4515
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addressed problem description
Initially it was conceived as performance improvement but on my test trees I was able to measure an improvement only with trees of 400+ nodes and only of 1%. Probably the improvement can be more significant on bigger lightweight trees. But also the new feature is introduced:
We have sockets which store their default properties in their nodes. It involves using of
socket.node
api wich, as were said, takes O(len(tree.nodes)) time. Ve have alternative of storing default values in socket itself but switch all nodes to it will take a lot of time and most likely it will break work of Sverchok extensions.The solution is to move extracting of default values to the update system to which fo find a socket owner is not a problem. Update system can read default value and put it into socket_data cache where it can found by the node. So the socket_data module will keep not only generated by the nodes data but also and default values now.
I have doubts of adding extra complexity to data management but it seems the less sockets and nodes use
is_linked
API the better.Closes #4475
Preflight checklist