[ 
https://issues.apache.org/jira/browse/WINK-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12738018#action_12738018
 ] 

Michael Elman commented on WINK-115:
------------------------------------

The solution looks very good.
Just few really small points regarding the implementation:

* The key for the providersCache  map can be Class instead of String. So there 
won't be need for a String className = cls.getName() call. Since we are talking 
about efficiency here, this call is redundant and the hashCode/equals of Class 
should be faster, then of String.
* The key for the inner map can be MediaType instead of String, so there is no 
need to build the cacheKey.

I'm just curious: does it really makes 10% performance improvement?

> Add caching to MediaTypeMap.getProvidersbyMediaType() 
> ------------------------------------------------------
>
>                 Key: WINK-115
>                 URL: https://issues.apache.org/jira/browse/WINK-115
>             Project: Wink
>          Issue Type: Improvement
>          Components: Common
>    Affects Versions: 0.1
>            Reporter: Nick Gallardo
>            Assignee: Nick Gallardo
>             Fix For: 0.2
>
>         Attachments: WINK-115.patch
>
>
> Calls to MediaTypeMap.getProvidersByMediaType() are expensive, and happen a 
> multiple times per invocation.  Profiling the runtime shows this as one of 
> the major time blocks in successive get() calls.  
> Once we've done the work to define a mapping between the MediaType and the 
> parameter class, we can cache that content so we don't have to do the same 
> level of processing again.  One way to cache would be to build a Matrix of 
> MediaTypes to Class type mappings.  So, for every MediaType, we can lookup a 
> particular parameter class type and find the cached list of providers that 
> apply to that type.
> Caching this content results in at least 10% performance improvement.
> Working on a patch for this one.  Still trying to workout the caching scheme 
> exactly.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to