Skip to content

Commit

Permalink
net8 (#31)
Browse files Browse the repository at this point in the history
* net8

* Increment version

* Update dependencies

* update benchmark

* move to src folder

* fix folder case

* fix folder case

* fix images

* fix images

* fix readme

* add perf tests
  • Loading branch information
KovtunV authored Aug 24, 2024
1 parent 6bcdb13 commit c0e92a9
Show file tree
Hide file tree
Showing 401 changed files with 842 additions and 865 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/project-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ jobs:
- name: Build
run: dotnet build -c Release --no-restore

- name: Test
- name: Unit tests
run: dotnet test -c Release --no-restore --no-build -v=normal --collect:"XPlat Code Coverage"

- name: Performance tests
run: dotnet test -c Release --no-restore --no-build -v=normal --filter TestCategory="PerfTests"

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
Expand All @@ -39,3 +42,10 @@ jobs:
path: bin/NoStringEvaluating.Extensions.Microsoft.DependencyInjection/Release/*.nupkg
retention-days: 1

- name: Upload performance tests artifacts
uses: actions/upload-artifact@v4
with:
name: performance-tests
path: bin/NoStringEvaluating.Tests/Release/PerformanceTestsResults/PerformanceTests.txt
retention-days: 90

Binary file removed BenchResults/Benchmark.xlsx
Binary file not shown.
55 changes: 0 additions & 55 deletions BenchResults/both.html

This file was deleted.

6 changes: 6 additions & 0 deletions CodeAnalysis.ruleset
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for StyleCop.Analyzers" Description="Code analysis rules for StyleCop.Analyzers.csproj." ToolsVersion="17.0">
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
<Rule Id="IDE0305" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.NetAnalyzers" RuleNamespace="Microsoft.CodeAnalysis.NetAnalyzers">
<Rule Id="CA1861" Action="None" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA0001" Action="None" />
<Rule Id="SA1101" Action="None" />
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
</PropertyGroup>
Expand Down
21 changes: 10 additions & 11 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="7.0.2" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="8.0.8" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageVersion Include="NoStringEvaluating" Version="2.5.3" />
<PackageVersion Include="Spectre.Console" Version="0.49.1" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />

<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="NUnit" Version="4.1.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="AutoFixture" Version="4.17.0" />
<PackageVersion Include="FluentAssertions" Version="6.9.0" />

<PackageVersion Include="BenchmarkDotNet" Version="0.13.4" />
<PackageVersion Include="MathParser.org-mXparser" Version="5.2.1" />
<PackageVersion Include="AutoFixture" Version="4.18.1" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="MathParser.org-mXparser" Version="6.0.0" />
<PackageVersion Include="Ninject" Version="3.3.6" />
</ItemGroup>
</Project>
Binary file removed Images/Both.png
Binary file not shown.
Binary file removed Images/Graph.png
Binary file not shown.
Binary file removed Images/Table.png
Binary file not shown.
29 changes: 0 additions & 29 deletions NoStringEvaluating.Tests/Helpers/FormulaModelFactory.cs

This file was deleted.

30 changes: 0 additions & 30 deletions NoStringEvaluating.Tests/Models/FormulaModel.cs

This file was deleted.

10 changes: 5 additions & 5 deletions NoStringEvaluating.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32611.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoStringEvaluating", "NoStringEvaluating\NoStringEvaluating.csproj", "{40AB411F-6002-4A69-A73F-17C5B7FC1508}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoStringEvaluating", "src\NoStringEvaluating\NoStringEvaluating.csproj", "{40AB411F-6002-4A69-A73F-17C5B7FC1508}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoStringEvaluating.Tests", "NoStringEvaluating.Tests\NoStringEvaluating.Tests.csproj", "{48E04BE8-5BA6-409A-964E-13206F95BC8D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoStringEvaluating.Tests", "src\NoStringEvaluating.Tests\NoStringEvaluating.Tests.csproj", "{48E04BE8-5BA6-409A-964E-13206F95BC8D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{EA941063-94B8-4F97-A507-B5A7FD6A0B79}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{6A870F87-7BD9-4DB3-ACA2-0F2EFF9FB1D3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "src\ConsoleApp\ConsoleApp.csproj", "{6A870F87-7BD9-4DB3-ACA2-0F2EFF9FB1D3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{88F0773E-1AA1-4C00-A8D8-F09B76A70BE9}"
ProjectSection(SolutionItems) = preProject
codecov.yml = codecov.yml
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoStringEvaluating.Extensions.Microsoft.DependencyInjection", "NoStringEvaluating.Extensions.Microsoft.DependencyInjection\NoStringEvaluating.Extensions.Microsoft.DependencyInjection.csproj", "{03E4E4C4-C186-4865-AC39-8E5E192D7F14}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoStringEvaluating.Extensions.Microsoft.DependencyInjection", "src\NoStringEvaluating.Extensions.Microsoft.DependencyInjection\NoStringEvaluating.Extensions.Microsoft.DependencyInjection.csproj", "{03E4E4C4-C186-4865-AC39-8E5E192D7F14}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoStringEvaluating.Extensions.Microsoft.DependencyInjection.Tests", "NoStringEvaluating.Extensions.Microsoft.DependencyInjection.Tests\NoStringEvaluating.Extensions.Microsoft.DependencyInjection.Tests.csproj", "{95AC9D45-49F2-41A2-88BC-E800F932C356}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoStringEvaluating.Extensions.Microsoft.DependencyInjection.Tests", "src\NoStringEvaluating.Extensions.Microsoft.DependencyInjection.Tests\NoStringEvaluating.Extensions.Microsoft.DependencyInjection.Tests.csproj", "{95AC9D45-49F2-41A2-88BC-E800F932C356}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ci", "Ci", "{F2A9F436-5A49-486D-B4E1-B1B38924F61B}"
ProjectSection(SolutionItems) = preProject
Expand Down
15 changes: 0 additions & 15 deletions NoStringEvaluating/Exceptions/NoStringFunctionException.cs

This file was deleted.

21 changes: 0 additions & 21 deletions NoStringEvaluating/Exceptions/VariableNotFoundException.cs

This file was deleted.

20 changes: 0 additions & 20 deletions NoStringEvaluating/Nodes/Base/BaseFormulaNode.cs

This file was deleted.

33 changes: 0 additions & 33 deletions NoStringEvaluating/Nodes/Common/FormulaNodes.cs

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,26 @@ Compared with a good solution [mXparser](https://github.com/mariuszgromada/MathP
| 3 | 3 \* (9 / 456 \* (32 + 12)) / 17 - 3 |
| 4 | (2 + 6 - (13 \* 24 + 5 / (123 - 364 + 23))) - (2 + 6 - (13 \* 24 + 5 / (123 - 364 + 23))) + (2 + 6 - (13 \* 24 + 5 / (123 - 364 + 23))) \* 345 \* ((897 - 323)/ 23) |
| 5 | Arg1 \* Arg2 + Arg3 - Arg4 |
| 6 | Arg1 \* (Arg2 + Arg3) - Arg4 / (Arg5 - Arg6) + 45 \* Arg7 + ((Arg8 \* 56 + (12 + Arg9))) - Arg10 |
| 6 | Arg1 \* (Arg2 + Arg3) - Arg4 / (Arg5 - Arg6 + 1) + 45 \* Arg7 + ((Arg8 \* 56 + (12 + Arg9))) - Arg10 |
| 7 | add(1; 2; 3) |
| 8 | add(add(5; 1) - add(5; 2; 3)) |
| 9 | if(Arg1 > 0; add(56 + 9 / 12 \* 123.596; or(78; 9; 5; 2; 4; 5; 8; 7); 45;5); 9) \* 24 + 52 -33 |
| 10 | kov(1; 2; 3) - kovt(8; 9) |

### 1 000 000 calculations
Less is better
![image graph](Images/Graph.png)
![image table](Images/Table.png)
![image graph](images/Graph.png)
![image table](images/Table.png)

### Benchmark results
![Both](Images/Both.png)
![Both](images/Both.png)

### Conclusion
As you can see this solution is faster in all cases, furthermore there isn't any garbage collection.

Benchmark code - [ConsoleApp/Benchmark/BenchmarkNumberService.cs](ConsoleApp/Benchmark/BenchmarkNumberService.cs "ConsoleApp/Benchmark/BenchmarkNumberService.cs")
Benchmark code - [src/ConsoleApp/Benchmark/BenchNumbers.cs](src/ConsoleApp/Benchmark/BenchNumbers.cs "src/ConsoleApp/Benchmark/BenchNumbers.cs")

Benchmark excel - [BenchResults/Benchmark.xlsx](BenchResults/Benchmark.xlsx "BenchResults/Benchmark.xlsx")
Benchmark excel - [benchResults/Benchmark.xlsx](benchResults/Benchmark.xlsx "benchResults/Benchmark.xlsx")

## Quick start
### Initialization
Expand Down
Binary file added benchResults/Benchmark.xlsx
Binary file not shown.
Loading

0 comments on commit c0e92a9

Please sign in to comment.