From 2a37322d78c9ce1d27cbc12e24dd918407a931e3 Mon Sep 17 00:00:00 2001 From: "Emma [it/its]@Rory&" Date: Mon, 3 Jun 2024 04:59:40 +0200 Subject: Update dependencies, some tests, other things --- .../LibMatrix.EventTypes.Benchmark/Program.cs | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Utilities/LibMatrix.EventTypes.Benchmark/Program.cs (limited to 'Utilities/LibMatrix.EventTypes.Benchmark/Program.cs') diff --git a/Utilities/LibMatrix.EventTypes.Benchmark/Program.cs b/Utilities/LibMatrix.EventTypes.Benchmark/Program.cs new file mode 100644 index 0000000..512c066 --- /dev/null +++ b/Utilities/LibMatrix.EventTypes.Benchmark/Program.cs @@ -0,0 +1,37 @@ +using System.Text.Json; +using ArcaneLibs.Extensions; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Jobs; +using BenchmarkDotNet.Running; +using LibMatrix.EventTypes; +using LibMatrix.EventTypes.Spec; + +BenchmarkRunner.Run(); + +[ShortRunJob] +[MemoryDiagnoser] +public class Tests { + // public MatrixEventCollection Members = [ + // new MatrixEvent() { + // Content = new() { + // Membership = "join" + // } + // } + // ]; + + private static string eventJson = File.ReadAllText("test-event.json"); + private static MatrixEvent evt2 = JsonSerializer.Deserialize>(eventJson); + [Benchmark] + public void Deserialise() { + JsonSerializer.Deserialize>(eventJson); + } + [Benchmark] + public void Serialise() { + evt2.ToJson(); + } + + [Benchmark] + public void Modify() { + evt2.Content.Membership = "meow"; + } +} \ No newline at end of file -- cgit 1.4.1