Skip to content

Commit 5f4e93c

Browse files
authored
add the real FastCloner to the benchmark and correct FastDeepCloner's name (#12)
1 parent 259073d commit 5f4e93c

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,3 +400,4 @@ FodyWeavers.xsd
400400

401401
# Generated files
402402
/Dolly/Generated/*
403+
/.idea

Dolly.Benchmarks/CloneBenchmarks.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Dolly.Benchmarks;
77

88
[MemoryDiagnoser]
9+
[Orderer(BenchmarkDotNet.Order.SummaryOrderPolicy.FastestToSlowest)]
910
public class CloneBenchmarks
1011
{
1112
private readonly ComplexClass _complexClass;
@@ -89,8 +90,8 @@ public void TestDeepCloner()
8990
DeepClonerExtensions.DeepClone(_complexClass);
9091
}
9192

92-
[Benchmark(Description = "FastCloner")]
93-
public void TestFastCloner()
93+
[Benchmark(Description = "FastDeepCloner")]
94+
public void TestFastDeepCloner()
9495
{
9596
var clone = FastDeepCloner.DeepCloner.Clone(_complexClass);
9697
}
@@ -106,4 +107,10 @@ public void TestAnyClone()
106107
{
107108
var clone = AnyClone.CloneExtensions.Clone(_complexClass);
108109
}
110+
111+
[Benchmark(Description = "FastCloner")]
112+
public void TestFastCloner()
113+
{
114+
var clone = _complexClass.FastDeepClone();
115+
}
109116
}

Dolly.Benchmarks/Dolly.Benchmarks.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
1313
<PackageReference Include="CloneExtensions" Version="1.4.2" />
1414
<PackageReference Include="DeepCloner" Version="0.10.4" />
15+
<PackageReference Include="FastCloner.SourceGenerator" Version="1.0.1">
16+
<PrivateAssets>all</PrivateAssets>
17+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18+
</PackageReference>
19+
<PackageReference Include="FastCloner.SourceGenerator.Shared" Version="1.0.0" />
1520
<PackageReference Include="FastDeepCloner" Version="1.3.6" />
1621
<PackageReference Include="NClone" Version="1.2.0" />
1722
</ItemGroup>

Dolly.Benchmarks/SimpleClass.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using FastCloner.SourceGenerator.Shared;
2+
13
namespace Dolly.Benchmarks;
24

35
public class SimpleClassBase
@@ -6,6 +8,7 @@ public class SimpleClassBase
68
}
79

810
[Clonable]
11+
[FastClonerClonable]
912
public partial class SimpleClass : SimpleClassBase
1013
{
1114
public int Int { get; set; }
@@ -18,6 +21,7 @@ public partial class SimpleClass : SimpleClassBase
1821
}
1922

2023
[Clonable]
24+
[FastClonerClonable]
2125
public partial class ComplexClass
2226
{
2327
public SimpleClass SimpleClass { get; set; }

0 commit comments

Comments
 (0)