-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial StringUtils benchmark (#373)
- Loading branch information
1 parent
81610ab
commit 3d2bd08
Showing
5 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\ApplicationInsights.Kubernetes\ApplicationInsights.Kubernetes.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BenchMarkDotNet" Version="0.14.0" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
|
||
<SignAssembly>True</SignAssembly> | ||
<AssemblyOriginatorKeyFile>..\..\src\PublicKey.snk</AssemblyOriginatorKeyFile> | ||
<DelaySign>True</DelaySign> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using Benchmark; | ||
using BenchmarkDotNet.Running; | ||
|
||
var summary = BenchmarkRunner.Run<StringUtilsBenchmark>(); | ||
Console.WriteLine(summary); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.ApplicationInsights.Kubernetes; | ||
|
||
namespace Benchmark; | ||
|
||
public class StringUtilsBenchmark | ||
{ | ||
[Params(25, 1023, 1024, 1025, 2097152, 3758096384, 3848290697216)] | ||
public long Input { get; set; } | ||
|
||
[Benchmark] | ||
public string BenchmarkGetReadableSize() | ||
{ | ||
return StringUtils.GetReadableSize(Input); | ||
} | ||
} |