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 #372

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ace1888
remove a dependency
mregen Aug 6, 2024
bfd0a97
simplify a few tests and reduce log output, fix benchmarks, default t…
mregen Aug 10, 2024
33cb499
add net6 app target
mregen Aug 10, 2024
1458b97
dictionary benchmarks
mregen Aug 10, 2024
9362330
Merge remote-tracking branch 'origin/master' into dictbenchmarks
mregen Aug 12, 2024
dc07390
fix a few pipeline builds
mregen Aug 12, 2024
0737e40
Bump BenchmarkDotNet from 0.13.12 to 0.14.0
dependabot[bot] Aug 12, 2024
ed82052
Merge remote-tracking branch 'origin/dependabot/nuget/BenchmarkDotNet…
mregen Aug 12, 2024
0255675
Merge remote-tracking branch 'origin/master' into dictbenchmarks
mregen Aug 13, 2024
8303a28
add test adapters
mregen Aug 27, 2024
4082993
merge main
mregen Aug 27, 2024
3b0bdd1
fix dependencies
mregen Aug 27, 2024
54e4947
benchmarks show up in release test runs
mregen Aug 27, 2024
d83da02
use getsessioncount
mregen Sep 8, 2024
d154db4
Merge remote-tracking branch 'origin/master' into dictbenchmarks
mregen Sep 8, 2024
022d042
fix build
mregen Sep 8, 2024
25d77ca
more benchmarks
mregen Oct 1, 2024
a9ef7ef
improve sessionmanager
mregen Oct 17, 2024
b672757
merge main374
mregen Oct 17, 2024
2f9d67d
fix continuationpoint
mregen Oct 17, 2024
eef7a5f
merge latest
mregen Dec 11, 2024
5c7fcdf
fix test setup
mregen Dec 18, 2024
cb8ee66
Merge branch 'main' into dictbenchmarks
mregen Feb 6, 2025
b11dc7e
Merge branch 'main' into dictbenchmarks
mregen Feb 6, 2025
7d36100
Merge branch 'main' into dictbenchmarks
mregen Feb 6, 2025
bfeeef3
Merge branch 'main' into dictbenchmarks
mregen Feb 6, 2025
60a44fd
Merge branch 'main' into dictbenchmarks
mregen Feb 16, 2025
131013a
Merge branch 'main' into dictbenchmarks
mregen Feb 18, 2025
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
2 changes: 1 addition & 1 deletion Libraries/Opc.Ua.Server/Server/StandardServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3141,7 +3141,7 @@
ServerInternal.Status.Variable.ClearChangeMasks(ServerInternal.DefaultSystemContext, true);

// exit if all client connections are closed.
var sessions = ServerInternal.SessionManager.GetSessions().Count;
var sessions = ServerInternal.SessionManager.GetSessionCount();

Check warning on line 3144 in Libraries/Opc.Ua.Server/Server/StandardServer.cs

View check run for this annotation

Codecov / codecov/patch

Libraries/Opc.Ua.Server/Server/StandardServer.cs#L3144

Added line #L3144 was not covered by tests
if (sessions == 0)
{
break;
Expand Down
6 changes: 6 additions & 0 deletions Libraries/Opc.Ua.Server/Session/SessionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,12 @@
}
}

/// <inheritdoc/>
public int GetSessionCount()
{
return m_sessions.Count;

Check warning on line 778 in Libraries/Opc.Ua.Server/Session/SessionManager.cs

View check run for this annotation

Codecov / codecov/patch

Libraries/Opc.Ua.Server/Session/SessionManager.cs#L778

Added line #L778 was not covered by tests
}

/// <inheritdoc/>
public IList<Session> GetSessions()
{
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 @@ -9,6 +9,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<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.3.2" />
<PackageReference Include="NUnit.Console" Version="3.19.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
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 @@ -11,6 +11,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<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.3.2" />
<PackageReference Include="NUnit.Console" Version="3.19.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<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" />
Expand Down
4 changes: 3 additions & 1 deletion 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.12.0" />
<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.3.2" />
<PackageReference Include="NUnit.Console" Version="3.19.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
Expand All @@ -30,7 +32,7 @@
<Choose>
<When Condition="'$(TargetFramework)' == 'net462'">
</When>
<When Condition="'$(TargetFramework)' == 'netstandard2.0'">
<When Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
</When>
<Otherwise>
<PropertyGroup Condition="'$(DisableECCTests)' != 'true'">
Expand Down
Loading
Loading