suggest performance using Dictionary

Forums 💬 NodeCanvas ⚙️ Support suggest performance using Dictionary

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17552
    taiyoung.jang
    Participant

      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

      #17553
      Gavalakis
      Keymaster

        Hello,

        Thanks for your suggestions. I will take another look at the code there. 🙂
        Cheers!

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.