Skip to content

Commit

Permalink
exclude source generators from ci until stable
Browse files Browse the repository at this point in the history
  • Loading branch information
lofcz committed Jan 9, 2025
1 parent c0ff64c commit a544676
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ jobs:
node-version: '22'

- name: Restore dependencies
run: dotnet restore
run: dotnet restore FastClonerCi.slnf

- name: Build
run: dotnet build --no-restore
run: dotnet build FastClonerCi.slnf --no-restore

- name: Test
run: dotnet test --no-build --verbosity normal
run: dotnet test FastClonerCi.slnf --no-build --verbosity normal

- name: Update GitHub status check
if: always()
Expand Down
77 changes: 77 additions & 0 deletions FastCloner.Benchmark/Dictionary.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using BenchmarkDotNet.Attributes;
using Force.DeepCloner;

namespace FastCloner.Benchmark;

[RankColumn]
[Orderer(BenchmarkDotNet.Order.SummaryOrderPolicy.FastestToSlowest)]
[MemoryDiagnoser]
public class DictionaryBenchmark
{
private Dictionary<ComplexKey, string> testData;

[GlobalSetup]
public void Setup()
{
testData = new Dictionary<ComplexKey, string>();

for (int i = 0; i < 1000; i++)
{
ComplexKey key = new ComplexKey { Id = i, Name = $"Key{i}" };
testData.Add(key, $"Value{i}");
}
}

[Benchmark(Baseline = true)]
public object? FastCloner()
{
return global::FastCloner.FastCloner.DeepClone(testData);
}

[Benchmark]
public object? DeepCopier()
{
return global::DeepCopier.Copier.Copy(testData);
}

[Benchmark]
public object? DeepCopy()
{
return global::DeepCopy.DeepCopier.Copy(testData);
}

[Benchmark]
public object DeepCopyExpression()
{
return global::DeepCopy.ObjectCloner.Clone(testData);
}

[Benchmark]
public object? FastDeepCloner()
{
return global::FastDeepCloner.DeepCloner.Clone(testData);
}

[Benchmark]
public object? DeepCloner()
{
return testData.DeepClone();
}
}

public class ComplexKey
{
public int Id { get; set; }
public string Name { get; set; }

public override bool Equals(object obj)
{
if (obj is not ComplexKey other) return false;
return Id == other.Id && Name == other.Name;
}

public override int GetHashCode()
{
return HashCode.Combine(Id, Name);
}
}
11 changes: 11 additions & 0 deletions FastClonerCi.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"solution": {
"path": "FastCloner.sln",
"projects": [
"FastCloner\\FastCloner.csproj",
"FastCloner.Tests\\FastCloner.Tests.csproj",
"FastCloner.Contrib\\FastCloner.Contrib.csproj",
"FastCloner.Benchmark\\FastCloner.Benchmark.csproj"
]
}
}

0 comments on commit a544676

Please sign in to comment.