When the user changes any value on a Unit, it gets undefined and then defined again. This causes its connections to be removed, which causes VisualScriptingCanvas.Recollect to be called, which causes CacheWidgetCollections, CacheWidgetItems, and CacheWidgetPositions to be called, all of which are very slow for large graphs. This is problematic when typing values or moving sliders: the editor gets so slow it misses inputs.
I’m looking to optimize VisualScriptingCanvas somehow, but it’s hard to find meaningful wins given the event driven nature of the framework. Has anyone done any work in this area? Any advice?
Idea 1: Don’t make units redefine on trivial changes?
Idea 2: Somehow put the existing connections aside, let the Define run, and then skip undefining and restoring the unit if nothing changed? So that GraphElementCollection.CollectionChanged never fires on trivial changes.
Idea 3: Change Recollect to only refresh the unit and its connections?
Idea 4: Make controls not update the values immediately, like DelayedTextField, but for everything?