Skip to content

Commit

Permalink
Bump BenchmarkDotNet from 0.13.2 to 0.13.4 (#1413)
Browse files Browse the repository at this point in the history
* Bump BenchmarkDotNet from 0.13.2 to 0.13.4

Bumps [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) from 0.13.2 to 0.13.4.
- [Release notes](https://github.com/dotnet/BenchmarkDotNet/releases)
- [Commits](dotnet/BenchmarkDotNet@v0.13.2...v0.13.4)

---
updated-dependencies:
- dependency-name: BenchmarkDotNet
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump BenchmarkDotNet from 0.13.2 to 0.13.4

Bumps [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) from 0.13.2 to 0.13.4.
- [Release notes](https://github.com/dotnet/BenchmarkDotNet/releases)
- [Commits](dotnet/BenchmarkDotNet@v0.13.2...v0.13.4)

---
updated-dependencies:
- dependency-name: BenchmarkDotNet
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fixes and bump change log

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bernie White <bewhite@microsoft.com>
  • Loading branch information
dependabot[bot] and BernieWhite authored Feb 5, 2023
1 parent 3484587 commit 5462f35
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 41 deletions.
4 changes: 4 additions & 0 deletions docs/CHANGELOG-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ What's changed since v2.7.0:
[#1374](https://github.com/microsoft/PSRule/pull/1374)
Bump Microsoft.CodeAnalysis.Common to v4.4.0.
[#1341](https://github.com/microsoft/PSRule/pull/1341)
- Bump BenchmarkDotNet to v0.13.4.
[#1413](https://github.com/microsoft/PSRule/pull/1413)
- Bump BenchmarkDotNet.Diagnostics.Windows to v0.13.4.
[#1413](https://github.com/microsoft/PSRule/pull/1413)
- Bug fixes:
- Fixes handling of numerics in tests for that are impacted by regional format by @BernieWhite.
[#1405](https://github.com/microsoft/PSRule/issues/1405)
Expand Down
15 changes: 15 additions & 0 deletions src/PSRule.Benchmark/BenchmarkHostContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using PSRule.Pipeline;

namespace PSRule.Benchmark
{
internal sealed class BenchmarkHostContext : HostContext
{
public override bool ShouldProcess(string target, string action)
{
return true;
}
}
}
4 changes: 2 additions & 2 deletions src/PSRule.Benchmark/PSRule.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.4" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils" Version="1.1.1" />
</ItemGroup>

<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.4" />
</ItemGroup>

<ItemGroup>
Expand Down
44 changes: 15 additions & 29 deletions src/PSRule.Benchmark/PSRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,6 @@

namespace PSRule.Benchmark
{
public sealed class TargetObject
{
public TargetObject(string name, string message, string value)
{
Name = name;
Message = message;
Value = value;
}

public string Name { get; private set; }

public string Message { get; private set; }

public string Value { get; private set; }
}

/// <summary>
/// Define a set of benchmarks for performance testing PSRule internals.
/// </summary>
Expand All @@ -37,6 +21,7 @@ public TargetObject(string name, string message, string value)
public class PSRule
{
private PSObject[] _TargetObject;
private BenchmarkHostContext _HostContext;
private IPipeline _AssertPipeline;
private IPipeline _AssertHasFieldValuePipeline;
private IPipeline _GetPipeline;
Expand All @@ -55,6 +40,7 @@ public class PSRule
[GlobalSetup]
public void Prepare()
{
_HostContext = new BenchmarkHostContext();
PrepareGetPipeline();
PrepareGetHelpPipeline();
PrepareInvokePipeline();
Expand All @@ -75,7 +61,7 @@ private void PrepareGetPipeline()
{
var option = new PSRuleOption();
option.Rule.Include = new string[] { "Benchmark" };
var builder = PipelineBuilder.Get(GetSource(), option, null);
var builder = PipelineBuilder.Get(GetSource(), option, _HostContext);
_GetPipeline = builder.Build();
}

Expand All @@ -84,31 +70,31 @@ private void PrepareGetHelpPipeline()
var option = new PSRuleOption();
option.Rule.Include = new string[] { "BenchmarkHelp" };
option.Output.Culture = new string[] { "en-ZZ" };
var builder = PipelineBuilder.GetHelp(GetSource(), option, null);
var builder = PipelineBuilder.GetHelp(GetSource(), option, _HostContext);
_GetHelpPipeline = builder.Build();
}

private void PrepareInvokePipeline()
{
var option = new PSRuleOption();
option.Rule.Include = new string[] { "Benchmark" };
var builder = PipelineBuilder.Invoke(GetSource(), option, null);
var builder = PipelineBuilder.Invoke(GetSource(), option, _HostContext);
_InvokePipeline = builder.Build();
}

private void PrepareInvokeIfPipeline()
{
var option = new PSRuleOption();
option.Rule.Include = new string[] { "BenchmarkIf" };
var builder = PipelineBuilder.Invoke(GetSource(), option, null);
var builder = PipelineBuilder.Invoke(GetSource(), option, _HostContext);
_InvokeIfPipeline = builder.Build();
}

private void PrepareInvokeTypePipeline()
{
var option = new PSRuleOption();
option.Rule.Include = new string[] { "BenchmarkType" };
var builder = PipelineBuilder.Invoke(GetSource(), option, null);
var builder = PipelineBuilder.Invoke(GetSource(), option, _HostContext);
_InvokeTypePipeline = builder.Build();
}

Expand All @@ -117,47 +103,47 @@ private void PrepareInvokeSummaryPipeline()
var option = new PSRuleOption();
option.Rule.Include = new string[] { "Benchmark" };
option.Output.As = ResultFormat.Summary;
var builder = PipelineBuilder.Invoke(GetSource(), option, null);
var builder = PipelineBuilder.Invoke(GetSource(), option, _HostContext);
_InvokeSummaryPipeline = builder.Build();
}

private void PrepareAssertPipeline()
{
var option = new PSRuleOption();
option.Rule.Include = new string[] { "Benchmark" };
var builder = PipelineBuilder.Assert(GetSource(), option, null);
var builder = PipelineBuilder.Assert(GetSource(), option, _HostContext);
_AssertPipeline = builder.Build();
}

private void PrepareInvokeWithinPipeline()
{
var option = new PSRuleOption();
option.Rule.Include = new string[] { "BenchmarkWithin" };
var builder = PipelineBuilder.Invoke(GetWithinSource(), option, null);
var builder = PipelineBuilder.Invoke(GetWithinSource(), option, _HostContext);
_InvokeWithinPipeline = builder.Build();
}

private void PrepareInvokeWithinBulkPipeline()
{
var option = new PSRuleOption();
option.Rule.Include = new string[] { "BenchmarkWithinBulk" };
var builder = PipelineBuilder.Invoke(GetWithinSource(), option, null);
var builder = PipelineBuilder.Invoke(GetWithinSource(), option, _HostContext);
_InvokeWithinBulkPipeline = builder.Build();
}

private void PrepareInvokeWithinLikePipeline()
{
var option = new PSRuleOption();
option.Rule.Include = new string[] { "BenchmarkWithinLike" };
var builder = PipelineBuilder.Invoke(GetWithinSource(), option, null);
var builder = PipelineBuilder.Invoke(GetWithinSource(), option, _HostContext);
_InvokeWithinLikePipeline = builder.Build();
}

private void PrepareAssertHasFieldValuePipeline()
{
var option = new PSRuleOption();
option.Rule.Include = new string[] { "Assert.HasFieldValue" };
var builder = PipelineBuilder.Invoke(GetSource(), option, null);
var builder = PipelineBuilder.Invoke(GetSource(), option, _HostContext);
_AssertHasFieldValuePipeline = builder.Build();
}

Expand All @@ -174,14 +160,14 @@ private void PreparePathExpressionSelect()

private Source[] GetSource()
{
var builder = new SourcePipelineBuilder(null, null);
var builder = new SourcePipelineBuilder(_HostContext, null);
builder.Directory(GetSourcePath("Benchmark.Rule.ps1"));
return builder.Build();
}

private Source[] GetWithinSource()
{
var builder = new SourcePipelineBuilder(null, null);
var builder = new SourcePipelineBuilder(_HostContext, null);
builder.Directory(GetSourcePath("Benchmark.Within.Rule.ps1"));
return builder.Build();
}
Expand Down
16 changes: 8 additions & 8 deletions src/PSRule.Benchmark/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ private static void Main(string[] args)
private static void RunProfile(CommandLineApplication app)
{
var config = ManualConfig.CreateEmpty()
.With(ConsoleLogger.Default)
.With(DefaultColumnProviders.Instance)
.With(EnvironmentAnalyser.Default)
.With(OutliersAnalyser.Default)
.With(MinIterationTimeAnalyser.Default)
.With(MultimodalDistributionAnalyzer.Default)
.With(RuntimeErrorAnalyser.Default)
.With(ZeroMeasurementAnalyser.Default);
.AddLogger(ConsoleLogger.Default)
.AddColumnProvider(DefaultColumnProviders.Instance)
.AddAnalyser(EnvironmentAnalyser.Default)
.AddAnalyser(OutliersAnalyser.Default)
.AddAnalyser(MinIterationTimeAnalyser.Default)
.AddAnalyser(MultimodalDistributionAnalyzer.Default)
.AddAnalyser(RuntimeErrorAnalyser.Default)
.AddAnalyser(ZeroMeasurementAnalyser.Default);

app.Command("benchmark", cmd =>
{
Expand Down
21 changes: 21 additions & 0 deletions src/PSRule.Benchmark/TargetObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Benchmark
{
public sealed class TargetObject
{
public TargetObject(string name, string message, string value)
{
Name = name;
Message = message;
Value = value;
}

public string Name { get; private set; }

public string Message { get; private set; }

public string Value { get; private set; }
}
}
1 change: 0 additions & 1 deletion src/PSRule/Definitions/IResourceHelpInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using Newtonsoft.Json;

namespace PSRule.Definitions
Expand Down
1 change: 0 additions & 1 deletion src/PSRule/Host/HostHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.IO;
using System.Linq;
using System.Management.Automation;
Expand Down

0 comments on commit 5462f35

Please sign in to comment.