Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dictionary Benchmarks #2705

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SharpFuzz" Version="2.1.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet.TestAdapter" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Stack/Opc.Ua.Core/Stack/Bindings/BufferManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class Allocation
private readonly object m_lock = new object();
private int m_allocated;
private int m_id;
private SortedDictionary<int, Allocation> m_allocations = new SortedDictionary<int, Allocation>();
private Dictionary<int, Allocation> m_allocations = new Dictionary<int, Allocation>();
#else
private const byte kCookieLength = 1;
#endif
Expand Down
65 changes: 56 additions & 9 deletions Tests/Common/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,66 @@
* ======================================================================*/

using System;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Validators;
using Opc.Ua;

static class Program
[assembly: Config(typeof(BenchmarksDefaultConfig))]

class BenchmarksDefaultConfig : ManualConfig
{
// Main Method
public static void Main(String[] args)
public BenchmarksDefaultConfig()
{
IConfig config = ManualConfig.Create(DefaultConfig.Instance)
// need this option because of reference to nunit.framework
.WithOptions(ConfigOptions.DisableOptimizationsValidator)
;
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config);
if (Program.CmdLineUsed)
{
var defaults = DefaultConfig.Instance;
foreach (var exporter in defaults.GetExporters())
{
AddExporter(exporter);
}
foreach (var logger in defaults.GetLoggers())
{
AddLogger(logger);
}
foreach (var analyser in defaults.GetAnalysers())
{
AddAnalyser(analyser);
}
foreach (var validator in defaults.GetValidators())
{
AddValidator(validator);
}
WithOptions(ConfigOptions.DisableOptimizationsValidator);
}
else
{
AddJob(Job.Dry);
AddLogger(ConsoleLogger.Default);
AddValidator(JitOptimizationsValidator.DontFailOnError);
}
}
}

static class Program
{
/// <summary>
/// Whether command line was used to start.
/// </summary>
public static bool CmdLineUsed = false;

// Main Method
public static void Main(string[] args)
{
IConfig config = ManualConfig.Create(DefaultConfig.Instance)
// need this option because of reference to nunit.framework
.WithOptions(ConfigOptions.DisableOptimizationsValidator)
;
CmdLineUsed = true;
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit.Console" Version="3.18.3" />
<PackageReference Include="BenchmarkDotNet.TestAdapter" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Opc.Ua.Client.Tests/ContinuationPointInBatchTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ public void ParallelManagedBrowseWithManyContinuationPoints(ManagedBrowseTestDat
}

}
#endregion Tests
#endregion Tests

#region async tests

Expand Down
2 changes: 2 additions & 0 deletions Tests/Opc.Ua.Client.Tests/Opc.Ua.Client.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit.Console" Version="3.18.3" />
<PackageReference Include="BenchmarkDotNet.TestAdapter" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet.TestAdapter" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions Tests/Opc.Ua.Core.Tests/Opc.Ua.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="BenchmarkDotNet.TestAdapter" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit.Console" Version="3.18.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
Expand Down
Loading
Loading