Skip to content

Commit

Permalink
Added Reflection Performance Benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwalchadha committed Jul 20, 2020
1 parent c5efd9f commit 47e7b73
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Benchmarks/Benchmarks.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
name="BenchmarkComponent.ClassWithMultipleInterfaces"
threadingModel="both"
xmlns="urn:schemas-microsoft-com:winrt.v1" />
<activatableClass
name="BenchmarkComponent.ClassWithMarshalingRoutines"
threadingModel="both"
xmlns="urn:schemas-microsoft-com:winrt.v1" />
</file>

</assembly>
35 changes: 35 additions & 0 deletions Benchmarks/ReflectionPerf.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using BenchmarkComponent;
using BenchmarkDotNet.Attributes;

namespace Benchmarks
{
[MemoryDiagnoser]
public class ReflectionPerf
{
ClassWithMarshalingRoutines instance;

[GlobalSetup]
public void Setup()
{
instance = new ClassWithMarshalingRoutines();
}

[Benchmark]
public void ExecuteComWrappersCreateKeyValuePairsFactory()
{
var value = instance.DefaultKeyValuePairProperty;
}

[Benchmark]
public void ExecuteComWrappersCreateArrayFactory()
{
var value = instance.DefaultArrayProperty;
}

[Benchmark]
public void ExecuteComWrappersCreateNullableFactory()
{
var value = instance.DefaultNullableProperty;
}
}
}

0 comments on commit 47e7b73

Please sign in to comment.