-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathWriteValueStringBenchmarks.cs
35 lines (31 loc) · 1.06 KB
/
WriteValueStringBenchmarks.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using BenchmarkDotNet.Attributes;
namespace MirrorSharp.Benchmarks.Of.Json {
[InProcess]
public class WriteValueStringBenchmarks : JsonBenchmarksBase {
[Params("test", @"using System;
public class C {
public void M() {
}
}
", "")]
public string? Value { get; set; }
[Benchmark]
public void NewtonsoftJson_JsonWriter() {
_newtonsoftJsonWriter!.WriteValue(Value);
_newtonsoftJsonWriter.Flush();
//return FlushNewtonsoftJsonWriterAndGetBuffer();
}
[Benchmark]
public void MirrorSharp_FastJsonWriter() {
_fastJsonWriter!.WriteValue(Value);
//return _fastJsonWriter.WrittenSegment;
}
[Benchmark]
public void SystemTextJson_Utf8JsonWriter() {
_systemTextJsonWriter!.WriteStringValue(Value);
_systemTextJsonWriter.Flush();
//return FlushSystemTextJsonWriterAndGetBuffer();
}
}
}