Skip to content

Commit

Permalink
DYN-6293: Fix Perf tests (#14931)
Browse files Browse the repository at this point in the history
* Target net8

* Change defaukt value for graph option

* Update to latest

* More tweaks

* Use local Benchmark build

* Skip view tests comparion if the baseline is missing
  • Loading branch information
sm6srw authored Feb 28, 2024
1 parent 359760a commit b5a7221
Show file tree
Hide file tree
Showing 28 changed files with 6,366 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Platforms>AnyCPU;NET_Linux;</Platforms>
<Platforms>AnyCPU</Platforms>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<PlatformTarget>x64</PlatformTarget>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<OutputType>Exe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<OutputPath Condition=" '$(OutputPath)' == '' ">$(SolutionDir)\bin\$(Platform)\$(Configuration)</OutputPath>
</PropertyGroup>

<ItemGroup>
<Reference Include="BenchmarkDotNet">
<HintPath>$(SolutionDir)\extern\BenchmarkDotNet.dll</HintPath>
</Reference>
<Reference Include="BenchmarkDotNet.Annotations">
<HintPath>$(SolutionDir)\extern\BenchmarkDotNet.Annotations.dll</HintPath>
</Reference>
<Reference Include="DynamoCore">
<HintPath>..\..\..\bin\$(Platform)\$(Configuration)\DynamoCore.dll</HintPath>
</Reference>
Expand All @@ -22,6 +33,9 @@
<Reference Include="DynamoCoreWpfTests">
<HintPath>..\..\..\bin\$(Platform)\$(Configuration)\DynamoCoreWpfTests.dll</HintPath>
</Reference>
<Reference Include="DynamoServices">
<HintPath>..\..\..\bin\$(Platform)\$(Configuration)\DynamoServices.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\src\AssemblySharedInfoGenerator\AssemblySharedInfo.cs">
Expand All @@ -30,20 +44,25 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.11.4" />
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.6.0" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageReference Include="Perfolizer" Version="0.2.1" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.8.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.ComponentModel.Composition" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="System.ComponentModel.Composition" Version="8.0.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Management" Version="7.0.1" />
<PackageReference Include="System.Management" Version="8.0.0" />
</ItemGroup>

<PropertyGroup>
<PreBuildEvent>
robocopy ..\..\..\..\..\..\..\bin\$(Platform)\$(Configuration)\ . /s /xd fallback_docs
if %25ERRORLEVEL%25 GTR 3 ( exit 1 ) else ( exit 0 )
if exist ..\..\..\..\..\..\bin\$(Platform)\$(Configuration)\ (robocopy ..\..\..\..\..\..\bin\$(Platform)\$(Configuration)\ . /s /xd fallback_docs)
if exist ..\..\..\..\..\..\bin\$(Platform)\$(Configuration)\ (if %25ERRORLEVEL%25 GTR 3 ( exit 1 ) else ( exit 0 ))
if exist ..\..\..\..\..\..\..\..\..\..\bin\$(Platform)\$(Configuration)\ (robocopy ..\..\..\..\..\..\..\..\..\..\bin\$(Platform)\$(Configuration)\ . /s /xd fallback_docs)
if exist ..\..\..\..\..\..\..\..\..\..\bin\$(Platform)\$(Configuration)\ (if %25ERRORLEVEL%25 GTR 3 ( exit 1 ) else ( exit 0 ))
</PreBuildEvent>
<StartupObject>DynamoPerformanceTests.Program</StartupObject>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,17 @@ private static void Compare(string baseResultsPath, string newResultsPath, strin

// Create View comparer
Console.WriteLine("\nComparison of View tests: \n");
var baseViewPath = Path.Combine(PerformanceTestHelper.GetFullPath(baseResultsPath),viewTestBaseReport );
var newViewPath = Path.Combine(PerformanceTestHelper.GetFullPath(newResultsPath), viewTestBaseReport);
var viewSavePath = Path.Combine(PerformanceTestHelper.GetFullPath(savePath),viewTestComparison );

viewComparer = new ResultsComparer(baseViewPath, newViewPath, viewSavePath);
var baseViewPath = Path.Combine(PerformanceTestHelper.GetFullPath(baseResultsPath), viewTestBaseReport);
if (File.Exists(baseViewPath))
{
var newViewPath = Path.Combine(PerformanceTestHelper.GetFullPath(newResultsPath), viewTestBaseReport);
var viewSavePath = Path.Combine(PerformanceTestHelper.GetFullPath(savePath), viewTestComparison);
viewComparer = new ResultsComparer(baseViewPath, newViewPath, viewSavePath);
}
else
{
Console.WriteLine("No baseline view tests found to compare.");
}
}
//catch here - likely we could not create a view comparer if view comparison did not run.
catch(Exception e)
Expand Down
42 changes: 31 additions & 11 deletions tools/Performance/DynamoPerformanceTests/PerformanceTestHelper.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Validators;

Expand Down Expand Up @@ -75,7 +76,7 @@ public static DebugInProcessConfig getDebugInProcessConfig()
/// <summary>
/// Base config class for regular benchmark job
/// </summary>
public class DynamoBenchmarkConfig : ManualConfig
public class DynamoBenchmarkConfigBase : ManualConfig
{
/// <summary>
/// Minimum count of warmup iterations that should be performed
Expand All @@ -102,39 +103,58 @@ public class DynamoBenchmarkConfig : ManualConfig
/// </summary>
protected int DynamoMaxIterationCount = 9;

public DynamoBenchmarkConfig()
/// <summary>
/// Default Job Definition.
/// </summary>
protected Job JobDefault = Job.Default
.WithPlatform(BenchmarkDotNet.Environments.Platform.X64)
.WithRuntime(CoreRuntime.CreateForNewVersion("net8.0-windows7.0", "NET 8.0"));

public DynamoBenchmarkConfigBase()
{
Add(DefaultConfig.Instance.GetLoggers().ToArray()); // manual config has no loggers by default
Add(DefaultConfig.Instance.GetExporters().ToArray()); // manual config has no exporters by default
AddLogger(DefaultConfig.Instance.GetLoggers().ToArray());
AddExporter(DefaultConfig.Instance.GetExporters().ToArray()); // manual config has no exporters by default

var defaultColumns = DefaultConfig.Instance.GetColumnProviders().ToList();
defaultColumns.RemoveAt(3); // Remove DynamoFilePath column
Add(defaultColumns.ToArray());
Add(new GraphNameColumn()); // Add Graph Name column
AddColumnProvider(defaultColumns.ToArray());
AddColumn(new GraphNameColumn()); // Add Graph Name column
}
}

/// <summary>
/// config class for regular benchmark job
/// </summary>
public class DynamoBenchmarkConfig : DynamoBenchmarkConfigBase
{
public DynamoBenchmarkConfig() : base()
{
AddJob(JobDefault);
}
}

/// <summary>
/// Config class that when initialized and used to run the benchmarks
/// allows for testing of debug versions of DynamoCore targets.
/// </summary>
public class BenchmarkDebugConfig : DynamoBenchmarkConfig
public class BenchmarkDebugConfig : DynamoBenchmarkConfigBase
{
public BenchmarkDebugConfig() : base()
{
Add(JitOptimizationsValidator.DontFailOnError);
AddValidator(JitOptimizationsValidator.DontFailOnError);
AddJob(JobDefault);
}
}

/// <summary>
/// A faster version of Config class than default used to pass command line arguments from the
/// benchmark runner to all benchmarks defined in the test framework class.
/// </summary>
public class FastBenchmarkReleaseConfig : DynamoBenchmarkConfig
public class FastBenchmarkReleaseConfig : DynamoBenchmarkConfigBase
{
public FastBenchmarkReleaseConfig() : base()
{
Add(Job.Default
AddJob(JobDefault
.WithMinWarmupCount(DynamoMinWarmupCount)
.WithMaxWarmupCount(DynamoMaxWarmuoCount)
.WithLaunchCount(DynamoLaunchCount)
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit b5a7221

Please sign in to comment.