Skip to content
Closed
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
27 changes: 27 additions & 0 deletions src/benchmarks/micro/runtime/System.Reflection/RuntimeEventInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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.Reflection
{
[BenchmarkCategory(Categories.Runtime, Categories.Reflection)]
public class RuntimeEventInfo
{
private static readonly EventInfo s_eventInfo = typeof(RuntimeEventInfoTestClass).GetEvent(nameof(RuntimeEventInfoTestClass.Event1));

[Benchmark]
public int GetHashCodeBenchmark()
{
return s_eventInfo.GetHashCode();
}
}

public class RuntimeEventInfoTestClass
{
public event EventHandler Event1;
protected virtual void OnEvent1() => Event1?.Invoke(this, EventArgs.Empty);
}
}
26 changes: 26 additions & 0 deletions src/benchmarks/micro/runtime/System.Reflection/RuntimeFieldInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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.Reflection
{
[BenchmarkCategory(Categories.Runtime, Categories.Reflection)]
public class RuntimeFieldInfo
{
private static readonly FieldInfo s_fieldInfo = typeof(RuntimeFieldInfoTestClass).GetField(nameof(RuntimeFieldInfoTestClass.Field1));

[Benchmark]
public int GetHashCodeBenchmark()
{
return s_fieldInfo.GetHashCode();
}
}

public class RuntimeFieldInfoTestClass
{
public int Field1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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.Reflection
{
[BenchmarkCategory(Categories.Runtime, Categories.Reflection)]
public class RuntimeMethodInfo
{
private static readonly MethodInfo s_methodInfo = typeof(RuntimeMethodInfoTestClass).GetMethod(nameof(RuntimeMethodInfoTestClass.Method1));

[Benchmark]
public int GetHashCodeBenchmark()
{
return s_methodInfo.GetHashCode();
}
}

public class RuntimeMethodInfoTestClass
{
public int Method1() => throw new NotImplementedException();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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.Reflection
{
[BenchmarkCategory(Categories.Runtime, Categories.Reflection)]
public class RuntimePropertyInfo
{
private static readonly PropertyInfo s_propertyInfo = typeof(RuntimePropertyInfoTestClass).GetProperty(nameof(RuntimePropertyInfoTestClass.Property1));

[Benchmark]
public int GetHashCodeBenchmark()
{
return s_propertyInfo.GetHashCode();
}
}

public class RuntimePropertyInfoTestClass
{
public int Property1 { get; set; }
}
}