-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GUID lookup optimizations and benchmarks (#1099)
* Add GUID lookup benchmarks and optimization * More optimizations. * Add benchmarks * Reduce calls to .GUID attribute where possible. * Improve BindAs which showed up in managed QI calls. * Optimize weak reference scenario to reduce allocations and add benchmarks * Fix benchmark and replace GetIID call. * Update testwinrt
- Loading branch information
1 parent
133204d
commit e64e716
Showing
30 changed files
with
274 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using BenchmarkComponent; | ||
using BenchmarkDotNet.Attributes; | ||
using System; | ||
using System.Reflection; | ||
|
||
#if !NETCOREAPP3_1 | ||
using WinRT; | ||
|
||
namespace Benchmarks | ||
{ | ||
[MemoryDiagnoser] | ||
public class GuidPerf | ||
{ | ||
[Benchmark] | ||
public object GetClassGuid() | ||
{ | ||
return WinRT.GuidGenerator.GetIID(typeof(ClassWithMarshalingRoutines)); | ||
} | ||
|
||
[Benchmark] | ||
public object GetDelegateGuid() | ||
{ | ||
return WinRT.GuidGenerator.GetIID(typeof(Windows.Foundation.AsyncActionCompletedHandler)); | ||
} | ||
|
||
[Benchmark] | ||
public object CreateListGuid() | ||
{ | ||
return WinRT.GuidGenerator.CreateIID(typeof(System.Collections.Generic.IList<ClassWithMarshalingRoutines>)); | ||
} | ||
|
||
[Benchmark] | ||
public object CreateDictionaryWithStringKeyGuid() | ||
{ | ||
return WinRT.GuidGenerator.CreateIID(typeof(System.Collections.Generic.IDictionary<String, ClassWithMarshalingRoutines>)); | ||
} | ||
|
||
[Benchmark] | ||
public object CreateDictionaryWithBoolKeyGuid() | ||
{ | ||
return WinRT.GuidGenerator.CreateIID(typeof(System.Collections.Generic.IDictionary<bool, ClassWithMarshalingRoutines>)); | ||
} | ||
|
||
[Benchmark] | ||
public object CreateReadOnlyEnumListGuid() | ||
{ | ||
return WinRT.GuidGenerator.CreateIID(typeof(System.Collections.Generic.IReadOnlyList<Windows.Foundation.AsyncStatus>)); | ||
} | ||
|
||
[Benchmark] | ||
public object CreateReadOnlyFlagEnumListGuid() | ||
{ | ||
return WinRT.GuidGenerator.CreateIID(typeof(System.Collections.Generic.IReadOnlyList<Windows.Storage.FileAttributes>)); | ||
} | ||
|
||
[Benchmark] | ||
public object CreateReadOnlyStructListGuid() | ||
{ | ||
return WinRT.GuidGenerator.CreateIID(typeof(System.Collections.Generic.IReadOnlyList<NonBlittable>)); | ||
} | ||
|
||
[Benchmark] | ||
public object CreateReadOnlyInterfaceListGuid() | ||
{ | ||
return WinRT.GuidGenerator.CreateIID(typeof(System.Collections.Generic.IReadOnlyList<IIntProperties>)); | ||
} | ||
|
||
[Benchmark] | ||
public object CreateReadOnlyClassListGuid() | ||
{ | ||
return WinRT.GuidGenerator.CreateIID(typeof(System.Collections.Generic.IReadOnlyList<EventOperations>)); | ||
} | ||
|
||
[Benchmark] | ||
public object CreateReadOnlyDelegateListGuid() | ||
{ | ||
return WinRT.GuidGenerator.CreateIID(typeof(System.Collections.Generic.IReadOnlyList<ProvideInt>)); | ||
} | ||
} | ||
} | ||
#endif |
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
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.