Copy node/subflow by Reference

I was thinking about this feature and it seems to make sense. What if we could create copies of nodes/subflows without actually making a new node instance when deployed? I saw people having issues with memory allocation when using subflows because when they duplicate a subflow node node-red creates new instances of all nodes used in that subflow, including one new instance for the subflow, even when the subflow doesn't contain any changes, and it is mainly used more as a DRY solution. I know that there are solutions for that such as converting your subflow into a new flow tab and use a link:call node. However, since copy by reference is a thing in OOP and nodes are kind of objects in memory, why can't we copy nodes as references too? This way I wont have to create tabs for my subflows and then add link:call nodes.

  • creating a copy by reference would be offered as a new shortcut and context menu button for nodes.

  • A node reference can be turned into its own instance with a shortcut and a new context menu button.

  • A node reference will have its config values and credentials changed when any of the references is eddited.

  • A node reference has a subtle icon design above it such as a & or * to remind us of pointers.

  • There is a new context menu button and shortcut to delete a node and all its references.

I have several copies of the same function nodes and I don't need them to be new instances but just copies pointing to the same instance - references per say. I think this would help a lot to reduce memory consumption.

Each node is defined as an object. As soon as you make a copy several of the properties need to change - like x,y positions, id, and (as per your suggestion) the icon. So it is immediately not an exact copy so can’t be by reference. I don’t think it can be like overlay storage like docker uses that just stores differences. So not sure how this would ever work.