Skip to content

Add Perf_Guid::EqualsNotSame benchmark #2324

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

Merged
merged 3 commits into from
Mar 30, 2022
Merged
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
6 changes: 6 additions & 0 deletions src/benchmarks/micro/libraries/System.Runtime/Perf.Guid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ namespace System.Tests
public class Perf_Guid
{
const string guidStr = "a8a110d5-fc49-43c5-bf46-802db8f843ff";
const string guid2Str = "86A96B5D-F9B2-4CB5-B531-FC7021FA99D7";

private readonly Guid _guid;
private readonly Guid _same;
private readonly Guid _guid2;
private readonly byte[] _buffer;

public Perf_Guid()
{
_guid = new Guid(guidStr);
_same = new Guid(guidStr);
_guid2 = new Guid(guid2Str);
_buffer = _guid.ToByteArray();
}

Expand All @@ -35,6 +38,9 @@ public Perf_Guid()
[Benchmark]
public bool EqualsSame() => _guid.Equals(_same);

[Benchmark]
public bool EqualsNotSame() => _guid.Equals(_guid2);

[Benchmark]
public bool EqualsOperator() => _guid == _same;

Expand Down