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

add a Benchmarks project #1405

Merged
merged 3 commits into from
Feb 17, 2024
Merged
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
13 changes: 13 additions & 0 deletions src/Benchmarks/Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<ProjectReference Include="..\Humanizer\Humanizer.csproj" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions src/Benchmarks/EnumBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[MemoryDiagnoser(false)]
public class EnumBenchmarks
{
public enum EnumUnderTest
{
[Description("The description")]
MemberWithDescriptionAttribute,
MemberWithoutDescriptionAttribute,

[Display(Description = "Display value")]
MemberWithDisplayAttribute,
}

[Benchmark]
public string Humanize() => EnumUnderTest.MemberWithDisplayAttribute.Humanize();
}
8 changes: 8 additions & 0 deletions src/Benchmarks/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Global using directives

global using System.ComponentModel;
global using System.ComponentModel.DataAnnotations;
global using System.Security.Cryptography;
global using BenchmarkDotNet.Attributes;
global using BenchmarkDotNet.Running;
global using Humanizer;
1 change: 1 addition & 0 deletions src/Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BenchmarkRunner.Run<EnumBenchmarks>();
18 changes: 18 additions & 0 deletions src/Humanizer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{AA44
..\NuSpecs\Humanizer.nuspec = ..\NuSpecs\Humanizer.nuspec
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks", "Benchmarks\Benchmarks.csproj", "{6ACDB92B-AC86-4C59-9114-5DCF9543D945}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Humanizer.Tests.Shared\Humanizer.Tests.Shared.projitems*{fdec244b-f07e-4a5e-bb80-fbc6ac77a9aa}*SharedItemsImports = 13
Expand Down Expand Up @@ -136,6 +138,22 @@ Global
{511A7984-F455-4A6E-ADB9-9CAAC47EA079}.Release|x64.Build.0 = Release|Any CPU
{511A7984-F455-4A6E-ADB9-9CAAC47EA079}.Release|x86.ActiveCfg = Release|Any CPU
{511A7984-F455-4A6E-ADB9-9CAAC47EA079}.Release|x86.Build.0 = Release|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Debug|ARM.ActiveCfg = Debug|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Debug|ARM.Build.0 = Debug|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Debug|x64.ActiveCfg = Debug|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Debug|x64.Build.0 = Debug|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Debug|x86.ActiveCfg = Debug|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Debug|x86.Build.0 = Debug|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Release|Any CPU.Build.0 = Release|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Release|ARM.ActiveCfg = Release|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Release|ARM.Build.0 = Release|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Release|x64.ActiveCfg = Release|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Release|x64.Build.0 = Release|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Release|x86.ActiveCfg = Release|Any CPU
{6ACDB92B-AC86-4C59-9114-5DCF9543D945}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down