about summary refs log tree commit diff
path: root/Test/Program.cs
blob: 2739294617a343a8a8894105fa884144e675a068 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System.Text.Json;
using LibMatrix;
using LibMatrix.Homeservers.ImplementationDetails.Synapse.Models.Responses;

// var src1 = new SynapseCollectionResult<EventIdResponse>();
// var src2 = new SynapseCollectionResult<EventIdResponse>(chunkKey: "meow", nextTokenKey: "woof", prevTokenKey: "bark", totalKey: "purr");
//
// for (int i = 0; i < 10000000; i++) {
//     src1.Chunk.Add(new EventIdResponse { EventId = Guid.NewGuid().ToString() });
//     src2.Chunk.Add(new EventIdResponse { EventId = Guid.NewGuid().ToString() });
// }
//
// File.WriteAllText("src1.json", JsonSerializer.Serialize(src1, new JsonSerializerOptions(){WriteIndented = true}));
// File.WriteAllText("src2.json", JsonSerializer.Serialize(src2, new JsonSerializerOptions(){WriteIndented = true}));

using var stream1 = File.OpenRead("src1.json");
var dst1 = new SynapseCollectionResult<EventIdResponse>().FromJson(stream1, (item) => {
    ArgumentNullException.ThrowIfNull(item.EventId);
});

var a = new StateEventResponse();