You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and you marked it with this MethodImplOptions.NonSharedGeneric it would elide all the type checks for classes/interfaces as it does for structs meaning it would turn into a branchless function (and create an implementation for everyTFeature type it was called with).
Still performance issues with it being an interface generic method IFeatureCollection.Get<TFeature>(); but better performance...
Would it perhaps be worthwhile for the attribute to take a list of types that generic specialization for reference types would be valid for (ex: [GenericSpecialization(typeof(string))] or [GenericSpecialization(typeof(IHttpRequestFeature), typeof(IHttpResponseFeature))])?
I could imagine there being cases where you only want to specialize a handful of types and you want everything else to take the same code-path (such as if other types are unsupported)...
Proposal
If you had for example aspnet/KestrelHttpServer#2290
and you marked it with this
MethodImplOptions.NonSharedGeneric
it would elide all the type checks forclass
es/interface
s as it does forstruct
s meaning it would turn into a branchless function (and create an implementation for everyTFeature
type it was called with).Still performance issues with it being an interface generic method
IFeatureCollection.Get<TFeature>()
; but better performance...The text was updated successfully, but these errors were encountered: