Skip to content

Commit

Permalink
Allow benchmarks to run on Linux/Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Brant Burnett committed Dec 15, 2024
1 parent 2f75f0f commit 7c349f7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
13 changes: 10 additions & 3 deletions Snappier.Benchmarks/Configuration/FrameworkCompareConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BenchmarkDotNet.Columns;
using System;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
Expand All @@ -9,8 +10,14 @@ public class FrameworkCompareConfig : StandardConfig
{
public FrameworkCompareConfig(Job baseJob)
{
AddJob(baseJob
.WithRuntime(ClrRuntime.Net48));
#if NET6_0_OR_GREATER // OperatingSystem check is only available in .NET 6.0 or later, but the runner itself won't be .NET 4 anyway
if (OperatingSystem.IsWindows())
{
AddJob(baseJob
.WithRuntime(ClrRuntime.Net48));
}
#endif

AddJob(baseJob
.WithRuntime(CoreRuntime.Core60));
AddJob(baseJob
Expand Down
16 changes: 11 additions & 5 deletions Snappier.Benchmarks/Configuration/VersionComparisonConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,32 @@ public VersionComparisonConfig(Job baseJob)
{
var jobBefore = baseJob.WithCustomBuildConfiguration("Previous");

var jobBefore48 = jobBefore.WithRuntime(ClrRuntime.Net48).AsBaseline();
var jobBefore60 = jobBefore.WithRuntime(CoreRuntime.Core60).AsBaseline();
var jobBefore80 = jobBefore.WithRuntime(CoreRuntime.Core80).WithPgo().AsBaseline();
var jobBefore90 = jobBefore.WithRuntime(CoreRuntime.Core90).WithPgo().AsBaseline();

var jobAfter48 = baseJob.WithRuntime(ClrRuntime.Net48);
var jobAfter60 = baseJob.WithRuntime(CoreRuntime.Core60);
var jobAfter80 = baseJob.WithRuntime(CoreRuntime.Core80).WithPgo();
var jobAfter90 = baseJob.WithRuntime(CoreRuntime.Core90).WithPgo();

AddJob(jobBefore48);
AddJob(jobBefore60);
AddJob(jobBefore80);
AddJob(jobBefore90);

AddJob(jobAfter48);
AddJob(jobAfter60);
AddJob(jobAfter80);
AddJob(jobAfter90);

#if NET6_0_OR_GREATER // OperatingSystem check is only available in .NET 6.0 or later, but the runner itself won't be .NET 4 anyway
if (OperatingSystem.IsWindows())
{
var jobBefore48 = jobBefore.WithRuntime(ClrRuntime.Net48).AsBaseline();
var jobAfter48 = baseJob.WithRuntime(ClrRuntime.Net48);

AddJob(jobBefore48);
AddJob(jobAfter48);
}
#endif

WithOrderer(VersionComparisonOrderer.Default);

HideColumns(Column.EnvironmentVariables, Column.Job);
Expand Down

0 comments on commit 7c349f7

Please sign in to comment.