Benchmarks

May 13, 2022 · View on GitHub

Hardware and Software


BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19043.1645 (21H1/May2021Update)
11th Gen Intel Core i7-1185G7 3.00GHz, 1 CPU, 8 logical and 4 physical cores
.NET SDK=6.0.200
  [Host]     : .NET 6.0.2 (6.0.222.6406), X64 RyuJIT
  Job-ILXIOY : .NET 6.0.2 (6.0.222.6406), X64 RyuJIT


Comparison Modes

MethodFileSizeMeanMedianMinMaxP80P95Allocated
RawTextSmall94.05 μs94.09 μs93.13 μs95.36 μs94.35 μs94.80 μs75 KB
SemanticSmall104.65 μs104.27 μs102.67 μs107.86 μs105.55 μs107.76 μs75 KB

* All benchmarks are generated using the same small JSON object used in the System.Text.Json vs Newtonsoft Json section below, with array move detection enabled (default).

System.Text.Json vs Newtonsoft Json

Diff (including RFC JsonPatch)

MethodFileSizeMeanMedianMinMaxP80P95Allocated
SystemTextJsonSmall76.93 μs76.88 μs75.62 μs79.28 μs77.43 μs78.11 μs67 KB
JsonNetSmall84.97 μs84.75 μs83.72 μs87.68 μs85.64 μs86.38 μs132 KB
SystemTextJson_RfcSmall91.88 μs91.71 μs90.70 μs95.01 μs92.37 μs94.37 μs89 KB
JsonNet_RfcSmall102.15 μs102.10 μs100.49 μs104.37 μs102.58 μs103.29 μs150 KB
SystemTextJsonLarge3,739.64 μs3,734.25 μs3,626.78 μs3,902.76 μs3,781.22 μs3,844.92 μs3,365 KB
JsonNetLarge3,846.70 μs3,850.62 μs3,760.20 μs3,917.07 μs3,887.43 μs3,896.80 μs4,386 KB
SystemTextJson_RfcLarge4,897.11 μs4,868.30 μs4,722.99 μs5,196.12 μs4,930.06 μs5,159.49 μs4,667 KB
JsonNet_RfcLarge5,260.99 μs5,249.26 μs5,121.82 μs5,487.74 μs5,322.84 μs5,460.47 μs6,147 KB

DeepEquals

MethodFileSizeMeanMedianMinMaxP80P95Allocated
SystemTextJson_NodeSmall55.10 μs54.96 μs54.14 μs56.93 μs55.49 μs56.57 μs38 KB
SystemTextJson_DocumentSmall40.63 μs40.58 μs40.08 μs41.27 μs40.80 μs41.12 μs26 KB
JsonNetSmall57.84 μs57.62 μs57.17 μs59.40 μs58.07 μs58.98 μs91 KB
SystemTextJson_NodeLarge2,143.34 μs2,125.71 μs2,048.46 μs2,328.43 μs2,194.35 μs2,266.60 μs1,571 KB
SystemTextJson_DocumentLarge1,372.31 μs1,371.00 μs1,352.61 μs1,391.00 μs1,379.30 μs1,388.30 μs920 KB
JsonNetLarge2,208.71 μs2,209.77 μs2,182.51 μs2,246.30 μs2,223.80 μs2,235.96 μs2,426 KB

Patch

MethodFileSizeMeanMedianMinMaxP80P95Allocated
SystemTextJsonSmall35.45 μs35.42 μs34.43 μs36.97 μs35.86 μs36.52 μs35 KB
JsonNetSmall95.50 μs95.35 μs94.14 μs97.36 μs96.28 μs96.70 μs162 KB
SystemTextJsonLarge1,945.77 μs1,935.61 μs1,799.91 μs2,203.39 μs2,047.02 μs2,093.61 μs1,732 KB
JsonNetLarge4,324.16 μs4,315.50 μs4,184.21 μs4,506.67 μs4,378.94 μs4,433.86 μs5,088 KB

DeepClone

MethodFileSizeMeanMedianMinMaxP80P95Allocated
SystemTextJsonSmall28.98 μs29.05 μs27.99 μs29.53 μs29.29 μs29.42 μs40 KB
JsonNetSmall42.99 μs42.84 μs41.90 μs45.02 μs43.41 μs44.70 μs70 KB
SystemTextJsonLarge1,251.60 μs1,247.97 μs1,192.19 μs1,323.97 μs1,276.05 μs1,310.40 μs1,675 KB
JsonNetLarge1,708.43 μs1,706.69 μs1,664.39 μs1,783.04 μs1,731.47 μs1,759.00 μs2,128 KB

* All benchmarks for SystemTextJson methods are generated with JsonElementComparison.Semantic option and array move detection disabled because JsonDiffPatch.Net does not support array move detection.