Skip to content

Dictionary benchmarks - #372

Open
mregen wants to merge 33 commits into
mainfrom
dictbenchmarks
Open

Dictionary benchmarks#372
mregen wants to merge 33 commits into
mainfrom
dictbenchmarks

Conversation

@mregen

@mregen mregen commented Feb 6, 2025

Copy link
Copy Markdown
Owner

Proposed changes

Benchmarks to test impact of the different dictionary implementations

This pull request includes several changes to improve performance, add benchmarking capabilities, and refactor existing code. The most important changes include adding BenchmarkDotNet to multiple test projects, refactoring session management methods, and updating the HiResUtcNowTickCount method.

Benchmarking Capabilities:

  • Added BenchmarkDotNet and BenchmarkDotNet.TestAdapter packages to multiple test projects to enable benchmarking capabilities. (Tests/Opc.Ua.Client.ComplexTypes.Tests/Opc.Ua.Client.ComplexTypes.Tests.csproj, Tests/Opc.Ua.Client.Tests/Opc.Ua.Client.Tests.csproj, Tests/Opc.Ua.Configuration.Tests/Opc.Ua.Configuration.Tests.csproj, Tests/Opc.Ua.Core.Tests/Opc.Ua.Core.Tests.csproj, Tests/Opc.Ua.Gds.Tests/Opc.Ua.Gds.Tests.csproj, Tests/Opc.Ua.PubSub.Tests/Opc.Ua.PubSub.Tests.csproj, Tests/Opc.Ua.Security.Certificates.Tests/Opc.Ua.Security.Certificates.Tests.csproj, Tests/Opc.Ua.Server.Tests/Opc.Ua.Server.Tests.csproj) [1] [2] [3] [4] [5] [6] [7] [8]

Performance Improvements:

  • Changed SortedDictionary to Dictionary in the Allocation class to improve performance. (Stack/Opc.Ua.Core/Stack/Bindings/BufferManager.cs)

Code Refactoring:

  • Refactored session management by adding a GetSessionCount method to simplify session count retrieval. (Libraries/Opc.Ua.Server/Server/StandardServer.cs, Libraries/Opc.Ua.Server/Session/SessionManager.cs) [1] [2]

Method Updates:

  • Updated the HiResUtcNowTickCount method to improve readability and maintainability by storing stopWatch.ElapsedMilliseconds in a variable. (Tests/Opc.Ua.Core.Tests/Types/Utils/HiResClock.cs) [1] [2]

Configuration Changes:

  • Added a custom benchmark configuration class BenchmarksDefaultConfig to handle command line options and default configurations. (Tests/Common/Main.cs)

@codecov

codecov Bot commented Feb 6, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.95%. Comparing base (4740787) to head (5dbdabd).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #372      +/-   ##
==========================================
+ Coverage   54.91%   54.95%   +0.04%     
==========================================
  Files         349      349              
  Lines       66506    66507       +1     
  Branches    13640    13640              
==========================================
+ Hits        36521    36552      +31     
+ Misses      26001    25985      -16     
+ Partials     3984     3970      -14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant