Skip to content

Commit 187a4cd

Browse files
committed
cleanup
1 parent eec413a commit 187a4cd

4 files changed

Lines changed: 8 additions & 44 deletions

File tree

src/FastCloner.Benchmark.CI/Reporting/BenchmarkDiffReporter.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,20 +222,18 @@ private static string BuildCommentMarkdown(
222222
return sb.ToString().TrimEnd();
223223
}
224224

225-
sb.AppendLine("### Relative FastCloner vs DeepCloner change from latest `next` baseline");
225+
sb.AppendLine("### FastCloner vs latest `next` baseline");
226226
sb.AppendLine();
227227
sb.AppendLine($"- Baseline generated (UTC): `{baseline.GeneratedAtUtc:yyyy-MM-dd HH:mm:ss}`");
228228
sb.AppendLine($"- Regression thresholds: time > `{FormatPercent(options.TimeThreshold)}`, alloc > `{FormatPercent(options.AllocThreshold)}`");
229-
sb.AppendLine("- Anchor: compare the `FastCloner / DeepCloner` ratio from the baseline run to the current run, so hosted runner speed changes do not count as regressions by themselves.");
230-
sb.AppendLine("- Score guide: values below `1.00x` are better than DeepCloner, above `1.00x` are worse.");
231229
sb.AppendLine();
232-
sb.AppendLine("| Status | Benchmark | Time Score (Baseline) | Time Score (Current) | Delta Time Score | Alloc Score (Baseline) | Alloc Score (Current) | Delta Alloc Score |");
233-
sb.AppendLine("|---|---|---:|---:|---|---:|---:|---|");
230+
sb.AppendLine("| Status | Benchmark | Delta Time | Delta Alloc |");
231+
sb.AppendLine("|---|---|---|---|");
234232

235233
foreach (BaselineDiffItem item in diff.Items)
236234
{
237235
sb.AppendLine(
238-
$"| {FormatStatus(item.Status)} | {item.Benchmark} | {FormatScore(item.BaselineTimeScore)} | {FormatScore(item.CurrentTimeScore)} | {FormatCurrentDelta(item.TimeScoreDeltaRatio, options.SameThreshold, "closer to DeepCloner", "farther from DeepCloner")} | {FormatScore(item.BaselineAllocScore)} | {FormatScore(item.CurrentAllocScore)} | {FormatCurrentDelta(item.AllocScoreDeltaRatio, options.SameThreshold, "closer to DeepCloner", "farther from DeepCloner")} |");
236+
$"| {FormatStatus(item.Status)} | {item.Benchmark} | {FormatCurrentDelta(item.TimeScoreDeltaRatio, options.SameThreshold, "faster", "slower")} | {FormatCurrentDelta(item.AllocScoreDeltaRatio, options.SameThreshold, "less", "more")} |");
239237
}
240238

241239
AppendStatusSection(sb, "Regressions", diff.Items.Where(item => item.Status == DiffStatus.Regression).ToList(), options.SameThreshold);
@@ -296,8 +294,8 @@ private static void AppendStatusSection(
296294
sb.AppendLine();
297295
foreach (BaselineDiffItem item in items)
298296
{
299-
string timeDelta = FormatCurrentDelta(item.TimeScoreDeltaRatio, sameThreshold, "closer to DeepCloner", "farther from DeepCloner");
300-
string allocDelta = FormatCurrentDelta(item.AllocScoreDeltaRatio, sameThreshold, "closer to DeepCloner", "farther from DeepCloner");
297+
string timeDelta = FormatCurrentDelta(item.TimeScoreDeltaRatio, sameThreshold, "faster", "slower");
298+
string allocDelta = FormatCurrentDelta(item.AllocScoreDeltaRatio, sameThreshold, "less", "more");
301299
sb.AppendLine($"- `{item.Benchmark}`: time {timeDelta}, alloc {allocDelta}");
302300
}
303301
}

src/FastCloner.Tests/DynamicMaxRecursionDepthTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public void TestDeepExactObjectGraph_1500Levels_WithMRD1()
169169
}
170170

171171
[Test]
172-
public void Internal_CloneClassInternalExact_Should_Reset_CallDepth_After_WorkList_Switch()
172+
public void Internal_CloneClassInternal_Should_Reset_CallDepth_After_WorkList_Switch()
173173
{
174174
ExactNode root = new ExactNode
175175
{
@@ -186,7 +186,7 @@ public void Internal_CloneClassInternalExact_Should_Reset_CallDepth_After_WorkLi
186186
FastCloneState state = FastCloneState.Rent();
187187
try
188188
{
189-
ExactNode? clone = FastClonerGenerator.CloneClassInternalExact(root, state);
189+
ExactNode? clone = (ExactNode?)FastClonerGenerator.CloneClassInternal(root, state);
190190

191191
Assert.That(clone, Is.Not.Null);
192192
Assert.That(state.UseWorkList, Is.True);

src/FastCloner.Tests/TypeBehaviorTests.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -210,24 +210,6 @@ public void SetTypeBehavior_Ignore_RootObjectOfIgnoredType_ReturnsNull()
210210
// Assert
211211
Assert.That(cloned, Is.Null, "Cloning an object of an globally ignored type should return null.");
212212
}
213-
214-
[Test]
215-
public void Internal_CloneClassInternalExact_IgnoreTypeBehavior_ReturnsNull()
216-
{
217-
ClassToBeIgnored original = new ClassToBeIgnored { Data = "Important Data" };
218-
FastCloner.SetTypeBehavior<ClassToBeIgnored>(CloneBehavior.Ignore);
219-
220-
FastCloneState state = FastCloneState.Rent();
221-
try
222-
{
223-
ClassToBeIgnored? cloned = FastClonerGenerator.CloneClassInternalExact(original, state);
224-
Assert.That(cloned, Is.Null);
225-
}
226-
finally
227-
{
228-
FastCloneState.Return(state);
229-
}
230-
}
231213

232214
[Test]
233215
public void SetTypeBehavior_Ignore_ForPrimitiveIntProperty_SetsToDefault()

src/FastCloner/Code/FastClonerGenerator.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -608,22 +608,6 @@ private static bool TryGetGenericInterfaceArgument(Type type, Type genericInterf
608608
return CloneClassInternalTyped(obj, runtimeType, state, metadata);
609609
}
610610

611-
internal static T? CloneClassInternalExact<T>(T? obj, FastCloneState state) where T : class
612-
{
613-
if (obj is null)
614-
return null;
615-
616-
ClonerCache<T>.CacheEntry cacheEntry = ClonerCache<T>.GetCurrent();
617-
if (!FastClonerCache.HasActiveTypeBehaviorOverrides && cacheEntry.IsSafe)
618-
return obj;
619-
620-
Type objType = typeof(T);
621-
FastClonerCache.TypeCloneMetadata metadata = cacheEntry.Metadata ?? GetTypeMetadata(objType, state);
622-
623-
// Keep exact and polymorphic class cloning on the same decision path.
624-
return (T?)CloneClassInternalTyped(obj, objType, state, metadata);
625-
}
626-
627611
internal static object? CloneClassInternalNoTracking(object? obj, FastCloneState state)
628612
{
629613
if (obj is null)

0 commit comments

Comments
 (0)