Forums › 💬 NodeCanvas › ⚙️ Support › suggest performance using Dictionary
example fsSerializer.cs // suggest Dictionary.TryGetValue
private static bool IsObjectReference(fsData data) { if (data.IsDictionary == false) return false; return data.AsDictionary.ContainsKey(Key_ObjectReference); /// <— first access }
private fsResult InternalDeserialize_1_CycleReference(Type overrideConverterType, fsData data, Type storageType, ref object result, out List<fsObjectProcessor> processors) { if (IsObjectReference(data)) { int refId = int.Parse(data.AsDictionary[Key_ObjectReference].AsString); /// <— second access result = _references.GetReferenceObject(refId); processors = GetProcessors(result.GetType()); return fsResult.Success; }
return InternalDeserialize_3_Inheritance(overrideConverterType, data, storageType, ref result, out processors); }
and MessageRouter.cs listeners[message] /// many access
Hello,
Thanks for your suggestions. I will take another look at the code there. 🙂 Cheers!