Are you using React? Are all of your
props data immutable?
GoJS was designed for mutable data and model. When dealing with large diagrams and limited resources, for example when moving nodes, frequently copying memory is inherently inefficient.
For case 1, Model.addNodeData modifies the Model.nodeDataArray by pushing onto the Array. Of course there is a lot of other work to be done within the transaction: copying the template Node, adding it to a Layer, evaluating its Bindings, measuring and arranging all of the objects in its visual tree that need it, performing any invalid layouts, updating the document bounds and scrollbars if needed, and updating the drawn viewport.
For case 2, it depends on what you mean by:
If you are setting Model.nodeDataArray to a new Array, the diagram will discard all of the existing Nodes and create new Nodes as I just outlined for case 1.
If you are calling Model.mergeNodeDataArray, the model/diagram will make the minimum changes needed for update the diagram. That is what
Please read the rest of the page starting at https://gojs.net/latest/intro/usingModels.html#IdentityAndReferences