Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removing test for platform compatibility
  • Loading branch information
Carl Meyertons committed Sep 11, 2020
commit 70b885c7aeef4be1e11a72ae162d553dc87b7472
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@
<ProjectReference Condition="'$(TargetGroup)'=='netfx' AND $(ReferenceType)=='Project'" Include="$(NetFxSource)src\Microsoft.Data.SqlClient.csproj" />
<ProjectReference Include="$(AddOnsPath)AzureKeyVaultProvider\Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj" />
<ProjectReference Condition="$(ReferenceType.Contains('NetStandard'))" Include="$(TestsPath)NSLibrary\Microsoft.Data.SqlClient.NSLibrary.csproj" />
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Condition="$(ReferenceType)=='Package'" Include="Microsoft.Data.SqlClient" Version="$(TestMicrosoftDataSqlClientVersion)" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
using Xunit;

namespace Microsoft.Data.SqlClient.ManualTesting.Tests
{
Expand Down Expand Up @@ -69,21 +62,23 @@ public void Should_Not_Box()
#if DEBUG
return;
#endif
var config = ManualConfig.Create(DefaultConfig.Instance)
.WithOptions(ConfigOptions.DisableOptimizationsValidator)
.AddJob(Job.InProcess.WithLaunchCount(1).WithInvocationCount(1).WithIterationCount(1).WithWarmupCount(0).WithStrategy(RunStrategy.ColdStart))
.AddDiagnoser(MemoryDiagnoser.Default)
;
// cannot figure out an easy way to get this to work on all platforms

//var config = ManualConfig.Create(DefaultConfig.Instance)
// .WithOptions(ConfigOptions.DisableOptimizationsValidator)
// .AddJob(Job.InProcess.WithLaunchCount(1).WithInvocationCount(1).WithIterationCount(1).WithWarmupCount(0).WithStrategy(RunStrategy.ColdStart))
// .AddDiagnoser(MemoryDiagnoser.Default)
//;

var summary = BenchmarkRunner.Run<NoBoxingValueTypesBenchmark>(config);
//var summary = BenchmarkRunner.Run<NoBoxingValueTypesBenchmark>(config);

var numValueTypeColumns = 2;
var totalBytesWhenBoxed = IntPtr.Size * _count * numValueTypeColumns;
//var numValueTypeColumns = 2;
//var totalBytesWhenBoxed = IntPtr.Size * _count * numValueTypeColumns;

var report = summary.Reports.First();
//var report = summary.Reports.First();

Assert.Equal(1, report.AllMeasurements.Count);
Assert.True(report.GcStats.BytesAllocatedPerOperation < totalBytesWhenBoxed);
//Assert.Equal(1, report.AllMeasurements.Count);
//Assert.True(report.GcStats.BytesAllocatedPerOperation < totalBytesWhenBoxed);
}

public class NoBoxingValueTypesBenchmark
Expand Down