Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

IFeatureCollection.Get<TFeature> should be implemented via generic rather than typeof #2303

Closed
benaadams opened this issue Feb 7, 2018 · 1 comment
Assignees

Comments

@benaadams
Copy link
Contributor

benaadams commented Feb 7, 2018

Its currently implemented as a typeof wrapper over (TFeature)Get(typeof(TFeature)) which deteriorates more rapidly for the if``else if lookup chain that implementing with generics does.

                          Method |     Mean |         Op/s |
-------------------------------- |---------:|-------------:|
              GetViaTypeOf_First | 12.96 ns | 77,136,481.9 | IHttpRequestFeature 
    GetViaGenericViaTypeOf_First | 22.38 ns | 44,679,211.4 | IHttpRequestFeature 
             GetViaGeneric_First | 19.96 ns | 50,103,862.6 | IHttpRequestFeature
    
               GetViaTypeOf_Last | 69.91 ns | 14,304,944.1 | IHttpSendFileFeature
     GetViaGenericViaTypeOf_Last | 80.70 ns | 12,392,225.5 | IHttpSendFileFeature 
              GetViaGeneric_Last | 33.59 ns | 29,771,919.4 | IHttpSendFileFeature
     
             GetViaTypeOf_Custom | 76.84 ns | 13,014,603.2 |
   GetViaGenericViaTypeOf_Custom | 84.15 ns | 11,882,891.0 |
            GetViaGeneric_Custom | 44.21 ns | 22,617,022.7 |
   
           GetViaTypeOf_NotFound | 76.29 ns | 13,108,494.2 |
 GetViaGenericViaTypeOf_NotFound | 84.44 ns | 11,843,124.1 |
          GetViaGeneric_NotFound | 44.53 ns | 22,454,601.1 |
@muratg
Copy link
Contributor

muratg commented Feb 21, 2018

(Assigning to @halter73 who's already reviewing the PR)

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

No branches or pull requests

3 participants