Skip to content

Commit ae356be

Browse files
committed
Add benchmark project
1 parent f89aa90 commit ae356be

File tree

7 files changed

+71
-3
lines changed

7 files changed

+71
-3
lines changed

.github/workflows/wf-build-release-ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
2.0.x
2222
5.0.x
2323
6.0.x
24+
8.0.x
2425
2526
- name: Restore NuGet Packages
2627
run: dotnet restore
@@ -51,7 +52,8 @@ jobs:
5152
1.0.x
5253
2.0.x
5354
5.0.x
54-
6.0.x
55+
6.0.x
56+
8.0.x
5557
5658
- name: Run test .NET 3.5
5759
working-directory: QRCoderTests

.github/workflows/wf-build-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
2.0.x
2323
5.0.x
2424
6.0.x
25+
8.0.x
2526
2627
- name: Restore NuGet Packages
2728
run: dotnet restore
@@ -52,7 +53,8 @@ jobs:
5253
1.0.x
5354
2.0.x
5455
5.0.x
55-
6.0.x
56+
6.0.x
57+
8.0.x
5658
5759
- name: Run test .NET 3.5
5860
working-directory: QRCoderTests

.github/workflows/wf-build-test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
2.0.x
2222
5.0.x
2323
6.0.x
24+
8.0.x
2425
2526
- name: Restore NuGet Packages
2627
run: dotnet restore
@@ -51,7 +52,8 @@ jobs:
5152
1.0.x
5253
2.0.x
5354
5.0.x
54-
6.0.x
55+
6.0.x
56+
8.0.x
5557
5658
- name: Run test .NET 3.5
5759
working-directory: QRCoderTests

QRCoder.sln

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QRCoder.Xaml", "QRCoder.Xam
1717
EndProject
1818
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCoderApiTests", "QRCoderApiTests\QRCoderApiTests.csproj", "{5FACE5F6-53C9-4B89-91D4-162677893574}"
1919
EndProject
20+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCoderBenchmarks", "QRCoderBenchmarks\QRCoderBenchmarks.csproj", "{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}"
21+
EndProject
2022
Global
2123
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2224
Debug|Any CPU = Debug|Any CPU
@@ -137,6 +139,22 @@ Global
137139
{5FACE5F6-53C9-4B89-91D4-162677893574}.Release|x64.Build.0 = Release|Any CPU
138140
{5FACE5F6-53C9-4B89-91D4-162677893574}.Release|x86.ActiveCfg = Release|Any CPU
139141
{5FACE5F6-53C9-4B89-91D4-162677893574}.Release|x86.Build.0 = Release|Any CPU
142+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
143+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Debug|Any CPU.Build.0 = Debug|Any CPU
144+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Debug|ARM.ActiveCfg = Debug|Any CPU
145+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Debug|ARM.Build.0 = Debug|Any CPU
146+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Debug|x64.ActiveCfg = Debug|Any CPU
147+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Debug|x64.Build.0 = Debug|Any CPU
148+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Debug|x86.ActiveCfg = Debug|Any CPU
149+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Debug|x86.Build.0 = Debug|Any CPU
150+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|Any CPU.ActiveCfg = Release|Any CPU
151+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|Any CPU.Build.0 = Release|Any CPU
152+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|ARM.ActiveCfg = Release|Any CPU
153+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|ARM.Build.0 = Release|Any CPU
154+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|x64.ActiveCfg = Release|Any CPU
155+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|x64.Build.0 = Release|Any CPU
156+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|x86.ActiveCfg = Release|Any CPU
157+
{C33AB74A-2AB3-4BEA-A67F-EAB578E74E25}.Release|x86.Build.0 = Release|Any CPU
140158
EndGlobalSection
141159
GlobalSection(SolutionProperties) = preSolution
142160
HideSolutionNode = FALSE

QRCoderBenchmarks/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using BenchmarkDotNet.Running;
2+
3+
BenchmarkRunner.Run(typeof(Program).Assembly);

QRCoderBenchmarks/QRCodeGenerator.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using BenchmarkDotNet.Attributes;
2+
3+
namespace QRCoderBenchmarks;
4+
5+
[MemoryDiagnoser]
6+
public class QRCodeGenerator
7+
{
8+
[Benchmark]
9+
public void CreateQRCode()
10+
{
11+
var payload = new QRCoder.PayloadGenerator.Url("HTTP://WWW.GOOGLE.COM/");
12+
QRCoder.QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator();
13+
_ = qrGenerator.CreateQrCode(payload, QRCoder.QRCodeGenerator.ECCLevel.L);
14+
}
15+
16+
[Benchmark]
17+
public void CreateQRCodeLong()
18+
{
19+
var payload = new QRCoder.PayloadGenerator.Url("https://github.com/codebude/QRCoder/blob/f89aa90081f369983a9ba114e49cc6ebf0b2a7b1/QRCoder/Framework4.0Methods/Stream4Methods.cs");
20+
QRCoder.QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator();
21+
_ = qrGenerator.CreateQrCode(payload, QRCoder.QRCodeGenerator.ECCLevel.H);
22+
}
23+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\QRCoder\QRCoder.csproj" />
16+
</ItemGroup>
17+
18+
</Project>

0 commit comments

Comments
 (0)