Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Helper Method Frames (HMF) from Reflection #109996

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

AaronRobinsonMSFT
Copy link
Member

Convert RuntimeMethodHandle.GetDeclaringType() to managed and QCall.
Convert RuntimeTypeHandle.GetElementType() to managed.
Correct nullability in signature and usage.
Convert RuntimeTypeHandle.GetDeclaringType() to managed and QCalls.
Remove GetRuntimeTypeHelper().

Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

@AaronRobinsonMSFT
Copy link
Member Author

@EgorBot -intel -arm64 -perf

using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

BenchmarkRunner.Run<Bench>(args: args);

public class Bench
{
    struct S;

    [Benchmark]
    public Type Nested() => typeof(S).DeclaringType;

    [Benchmark]
    public Type NotNested() => typeof(Bench).DeclaringType;

    [Benchmark]
    public Type RefElementType() => typeof(Bench[]).GetElementType();

    [Benchmark]
    public Type ValueElementType() => typeof(S[]).GetElementType();
}

@AaronRobinsonMSFT
Copy link
Member Author

@EgorBot -x64 -arm64 -profiler

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

public class Bench
{
    struct S;

    [Benchmark]
    public Type Nested() => typeof(S).DeclaringType;

    [Benchmark]
    public Type NotNested() => typeof(Bench).DeclaringType;

    [Benchmark]
    public Type RefElementType() => typeof(Bench[]).GetElementType();

    [Benchmark]
    public Type ValueElementType() => typeof(S[]).GetElementType();
}

@EgorBo
Copy link
Member

EgorBo commented Nov 20, 2024

@AaronRobinsonMSFT the bot complained that -profiler flag should be used when there are not more than 3 [Benchmark] attributes. I think I should improve error reporting 🙂

@EgorBo
Copy link
Member

EgorBo commented Nov 20, 2024

@EgorBot -x64 -arm64

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

public class Bench
{
    struct S;

    [Benchmark]
    public Type Nested() => typeof(S).DeclaringType;

    [Benchmark]
    public Type NotNested() => typeof(Bench).DeclaringType;

    [Benchmark]
    public Type RefElementType() => typeof(Bench[]).GetElementType();

    [Benchmark]
    public Type ValueElementType() => typeof(S[]).GetElementType();
}

@AaronRobinsonMSFT
Copy link
Member Author

@EgorBot -x64 -arm64 -profiler

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

public class Bench
{
    struct S;

    [Benchmark]
    public Type RefElementType() => typeof(Bench[]).GetElementType();

    [Benchmark]
    public Type ValueElementType() => typeof(S[]).GetElementType();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants