Open
Description
I have a benchmark here: https://github.com/jonathanpeppers/Benchmarks/blob/7db49fb3d272c5b07deda166dd4f5a5112258bbe/Benchmarks/Cecil.cs#L90-L111
And I am getting "not so great" results for SR.MetadataLoadContext
:
// * Summary *
BenchmarkDotNet=v0.11.3, OS=Windows 10.0.18362
Intel Core i9-9900K CPU 3.60GHz, 1 CPU, 16 logical and 8 physical cores
[Host] : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4010.0
DefaultJob : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4010.0
Method | Mean | Error | StdDev | Median | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
-------------------------------------- |------------:|-----------:|-----------:|------------:|------------:|------------:|------------:|--------------------:|
System.Reflection.Metadata | 32.84 ms | 0.1200 ms | 0.1123 ms | 32.85 ms | 3000.0000 | 62.5000 | - | 15.12 MB |
Mono.Cecil | 351.81 ms | 7.1738 ms | 21.1522 ms | 339.38 ms | 16000.0000 | 12000.0000 | 4000.0000 | 103.57 MB |
System.Reflection.MetadataLoadContext | 2,058.91 ms | 19.9863 ms | 18.6952 ms | 2,051.50 ms | 97000.0000 | 90000.0000 | 6000.0000 | 544.84 MB |
The performance compared to using raw SRM or Mono.Cecil is drastically worse.
I expected it to be somewhere in the middle of using SRM and Mono.Cecil. Is there something I'm doing here that would explain the poor performance?
Thanks!