-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing tests from .NET Core 3.0 perf tests blog post (#478)
* Add missing tests from .NET Core 3.0 perf tests blog post
- Loading branch information
1 parent
8e2e09d
commit 7d96fd3
Showing
25 changed files
with
391 additions
and
14 deletions.
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
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
23 changes: 23 additions & 0 deletions
23
src/benchmarks/micro/corefx/System.Net.NetworkInformation/PhysicalAddressTests.cs
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 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Linq; | ||
using BenchmarkDotNet.Attributes; | ||
using MicroBenchmarks; | ||
|
||
namespace System.Net.NetworkInformation.Tests | ||
{ | ||
[BenchmarkCategory(Categories.CoreFX)] | ||
public class PhysicalAddressTests | ||
{ | ||
private readonly PhysicalAddress _short = new PhysicalAddress(new byte[1] { 42 }); | ||
private readonly PhysicalAddress _long = new PhysicalAddress(Enumerable.Range(0, 256).Select(i => (byte)i).ToArray()); | ||
|
||
[Benchmark] | ||
public void PAShort() => _short.ToString(); | ||
|
||
[Benchmark] | ||
public void PALong() => _long.ToString(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/benchmarks/micro/corefx/System.Net.Primitives/DnsTests.cs
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,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using BenchmarkDotNet.Attributes; | ||
using MicroBenchmarks; | ||
|
||
namespace System.Net.Tests | ||
{ | ||
[BenchmarkCategory(Categories.CoreFX)] | ||
public class DnsTests | ||
{ | ||
[Benchmark] | ||
public IPHostEntry GetHostEntry() => Dns.GetHostEntry("34.206.253.53"); | ||
|
||
[Benchmark] | ||
public string GetHostName() => Dns.GetHostName(); | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
src/benchmarks/micro/corefx/System.Runtime.InteropServices/SafeHandleTests.cs
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,35 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using BenchmarkDotNet.Attributes; | ||
using MicroBenchmarks; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
namespace System.Runtime.InteropServices.Tests | ||
{ | ||
[BenchmarkCategory(Categories.CoreFX)] | ||
public class SafeHandleTests | ||
{ | ||
private readonly SafeFileHandle _sfh = new SafeFileHandle((IntPtr)12345, ownsHandle: false); | ||
|
||
[Benchmark] | ||
public IntPtr AddRef_GetHandle_Release() | ||
{ | ||
bool success = false; | ||
try | ||
{ | ||
_sfh.DangerousAddRef(ref success); | ||
return _sfh.DangerousGetHandle(); | ||
} | ||
finally | ||
{ | ||
if (success) | ||
{ | ||
_sfh.DangerousRelease(); | ||
} | ||
} | ||
} | ||
|
||
} | ||
} |
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
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
Oops, something went wrong.