diff --git a/Example.Frontend/Example.Frontend.csproj b/Example.Frontend/Example.Frontend.csproj index fdac1b1..0c1a745 100644 --- a/Example.Frontend/Example.Frontend.csproj +++ b/Example.Frontend/Example.Frontend.csproj @@ -14,7 +14,7 @@ - + JUST_LOAD diff --git a/Example.Frontend/Program.cs b/Example.Frontend/Program.cs index 3856ac5..6e91b88 100644 --- a/Example.Frontend/Program.cs +++ b/Example.Frontend/Program.cs @@ -131,7 +131,7 @@ class Program DemoCheck.TaskCancelation = true; #endif - const int iterations = 10; + const int iterations = 10000; var timer = Stopwatch.StartNew(); var x = 0; for (int i = 0; i < iterations; i++) @@ -147,7 +147,6 @@ class Program frontendBridge.Disconnect(); - DemoCheck.Show(); - Console.ReadKey(); + // DemoCheck.Show(); } } \ No newline at end of file diff --git a/mROA.Cbor/CborSerializationToolkit.cs b/mROA.Cbor/CborSerializationToolkit.cs index facd5c9..7943956 100644 --- a/mROA.Cbor/CborSerializationToolkit.cs +++ b/mROA.Cbor/CborSerializationToolkit.cs @@ -13,6 +13,7 @@ namespace mROA.Cbor { public class CborSerializationToolkit : IContextualSerializationToolKit { + private static Dictionary> _propertiesCache = new(); public static TimeSpan SerializationTime = TimeSpan.Zero; public byte[] Serialize(object objectToSerialize, IEndPointContext context) { @@ -231,7 +232,7 @@ namespace mROA.Cbor return; } - var properties = FilterProperties(type.GetProperties()); + var properties = GetAvalibleProperties(type); var values = properties.Select(property => property.GetValue(obj)).ToList(); WriteList(values, writer, context); } @@ -402,9 +403,7 @@ namespace mROA.Cbor private void FillObject(object obj, Type type, CborReader reader, IEndPointContext? context) { - var propertyInfos = type.GetProperties(); - var properties = FilterProperties(propertyInfos); - + var properties = GetAvalibleProperties(type); var length = reader.ReadStartArray(); try { @@ -441,5 +440,16 @@ namespace mROA.Cbor return finalProperties; } + + private List GetAvalibleProperties(Type type) + { + if (_propertiesCache.TryGetValue(type, out var properties)) + { + return properties; + } + var propertiesList = FilterProperties(type.GetProperties()); + _propertiesCache[type] = propertiesList; + return propertiesList; + } } } \ No newline at end of file diff --git a/mROA.Cbor/mROA.Cbor.csproj b/mROA.Cbor/mROA.Cbor.csproj index 1382ad8..ab207eb 100644 --- a/mROA.Cbor/mROA.Cbor.csproj +++ b/mROA.Cbor/mROA.Cbor.csproj @@ -4,8 +4,9 @@ netstandard2.1 enable true - 2.0.4 + 2.0.5 9 + mroaLogo.png @@ -24,4 +25,11 @@ + + + True + + + + diff --git a/mROA.Cbor/mroaLogo.png b/mROA.Cbor/mroaLogo.png new file mode 100644 index 0000000..7e70f53 Binary files /dev/null and b/mROA.Cbor/mroaLogo.png differ diff --git a/mROA.Codegen/mROA.Codegen.csproj b/mROA.Codegen/mROA.Codegen.csproj index 3eb3357..108ebcd 100644 --- a/mROA.Codegen/mROA.Codegen.csproj +++ b/mROA.Codegen/mROA.Codegen.csproj @@ -17,7 +17,8 @@ https://github.com/YaslePoy/mROA git True - 2.0.5 + 2.0.6 + mroaLogo.png @@ -30,6 +31,10 @@ + + True + + diff --git a/mROA.Codegen/mroaLogo.png b/mROA.Codegen/mroaLogo.png new file mode 100644 index 0000000..7e70f53 Binary files /dev/null and b/mROA.Codegen/mroaLogo.png differ diff --git a/mROA/Implementation/ChannelInteractionModule.cs b/mROA/Implementation/ChannelInteractionModule.cs index 5530a2b..5d71447 100644 --- a/mROA/Implementation/ChannelInteractionModule.cs +++ b/mROA/Implementation/ChannelInteractionModule.cs @@ -192,13 +192,10 @@ namespace mROA.Implementation public async Task SingleReceive(CancellationToken token = default) { - Console.WriteLine($"Receive start. Time: {profiler.ElapsedMilliseconds}ms"); var len = await ReadMessageLength(); - Console.WriteLine($"Received len {len}. Time: {profiler.ElapsedMilliseconds}ms"); var localSpan = _buffer[..len]; await _ioStream.ReadExactlyAsync(localSpan, cancellationToken: token); - Console.WriteLine($"Received. Time: {profiler.ElapsedMilliseconds}ms"); profiler.Restart(); var message = _serializationToolkit.Deserialize(localSpan, _context); MessageReceived(message); @@ -218,10 +215,8 @@ namespace mROA.Implementation var len = _serializationToolkit.Serialize(message, bodySpan.Span, _context); var header = BitConverter.GetBytes((ushort)len); header.CopyTo(_buffer); - Console.WriteLine($"Send start. Time: {profiler.ElapsedMilliseconds}ms"); var sendingSpan = _buffer[..(len + 2)]; await _ioStream.WriteAsync(sendingSpan, token); - Console.WriteLine($"Send. Time: {profiler.ElapsedMilliseconds}ms"); profiler.Restart(); } diff --git a/mROA/mROA.csproj b/mROA/mROA.csproj index 7397051..f2dbcf9 100644 --- a/mROA/mROA.csproj +++ b/mROA/mROA.csproj @@ -4,7 +4,7 @@ netstandard2.1 enable mROA - 2.0.6 + 2.0.7 YaslePoy Fast and easy RPC with contex https://github.com/YaslePoy/mROA @@ -14,6 +14,7 @@ 9 Debug;Release AnyCPU + mroaLogo.png @@ -29,4 +30,11 @@ + + + True + + + + diff --git a/mROA/mroaLogo.png b/mROA/mroaLogo.png new file mode 100644 index 0000000..7e70f53 Binary files /dev/null and b/mROA/mroaLogo.png differ