Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[perf] Much slower GetMethod and GetField than .NET Core #13029

@alexanderkyte

Description

@alexanderkyte

There is a whole suite in which .NET Core runs in 0.02 times the time that mono takes to run the suite. This suite is the PerfLabTests

  • .NET Core takes 101130.602 ns
  • Mono with AOT takes 4520483.984 ns
  • Mono's JIT with LLVM takes 3938013.177 ns to run (warmed-up) code

The benchmark is GetMethod from the GetMethod harness.

https://github.com/dotnet/performance/blob/b464901f239b7b2f63d2efd6a0196268f214f002/src/benchmarks/micro/coreclr/perflab/ReflectionPerf.cs#L77

I have extracted the relevant types into a standalone executable reproduction here

https://gist.github.com/alexanderkyte/2a49ceb411ec5554e3ea612fec747ca2

OSX's Instruments tool seems to suggest that the slowdown lies in repeated calls to mono_class_get_methods_by_name without caching, including what appears to be an expensive series of calls to mono_class_get_methods.

untitled

I think that .NET Core is probably doing a number of complex things to get their running time down, but it also looks like the biggest contributors to our running time are a couple of bits of low-hanging fruit.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions