dotnet / dotnet/macios

Emit specialized native method for methods in a closed subclass over a generic type

Open
#14,899 1 comment 0 reactions 0 assignees View on GitHub
enhancement performance
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 13h
Merged PRs (30d)
96

Description

### Steps to Reproduce

This is used as a node for an NSOutlineView, but it's possible to reproduce by just calling the `hash` selector.

```csharp
class RecursiveType where T:RecursiveType
{
public T MyValue;

public override nuint GetNativeHash()
{
return MyValue.GetHashCode();
}
}

sealed class ClosedView : RecursiveType
{
}
```

### Expected Behavior

The callpaths should be quick for the `sealed ClosedView`. The type has all the information needed to resolve without doing runtime checks.

### Actual Behavior

The methods are resolved at runtime via generic APIs.

See https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1533115/ and https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1532127

### Environment

VSMac, dotnet6 xamarin-macios, 6.0.201.

cc @rolfbjarne Does this need more information?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.