From 837ffe4ae15b3ccc4d4160bf05e4006b28ef95d2 Mon Sep 17 00:00:00 2001 From: Simon Rodriguez Date: Mon, 28 Nov 2022 21:45:09 +0100 Subject: [PATCH] reuse dynamicListPorts, as it could be created for every port with one or two allocations --- Scripts/NodeDataCache.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Scripts/NodeDataCache.cs b/Scripts/NodeDataCache.cs index e1b465c..da3a86e 100644 --- a/Scripts/NodeDataCache.cs +++ b/Scripts/NodeDataCache.cs @@ -9,6 +9,7 @@ namespace XNode { private static PortDataCache portDataCache; private static Dictionary> formerlySerializedAsCache; private static Dictionary typeQualifiedNameCache; + private static List dynamicListPorts; private static bool Initialized { get { return portDataCache != null; } } public static string GetTypeQualifiedName(System.Type type) { @@ -32,7 +33,6 @@ namespace XNode { Dictionary formerlySerializedAs = null; if (formerlySerializedAsCache != null) formerlySerializedAsCache.TryGetValue(nodeType, out formerlySerializedAs); - List dynamicListPorts = new List(); Dictionary staticPorts; if (!portDataCache.TryGetValue(nodeType, out staticPorts)) { @@ -103,6 +103,8 @@ namespace XNode { listPort.connectionType = backingPort.connectionType; listPort.typeConstraint = backingPort.typeConstraint; } + + dynamicListPorts.Clear(); } /// @@ -144,6 +146,7 @@ namespace XNode { /// Cache node types private static void BuildCache() { portDataCache = new PortDataCache(); + dynamicListPorts = new List(); System.Type baseType = typeof(Node); List nodeTypes = new List(); System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies();