[ 
https://issues.apache.org/jira/browse/YARN-6985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664613#comment-16664613
 ] 

Sunil Govindan commented on YARN-6985:
--------------------------------------

I agree to this optimization for better readability.

> The wrapper methods in Resources aren't useful
> ----------------------------------------------
>
>                 Key: YARN-6985
>                 URL: https://issues.apache.org/jira/browse/YARN-6985
>             Project: Hadoop YARN
>          Issue Type: Improvement
>          Components: resourcemanager
>    Affects Versions: 3.0.0-alpha4
>            Reporter: Daniel Templeton
>            Assignee: Suma Shivaprasad
>            Priority: Major
>         Attachments: YARN-6985.1.patch
>
>
> The code would be shorter, easier to read, and a tiny smidgeon faster if we 
> just called the {{ResourceCalculator}} methods directly.  I don't see where 
> the wrappers improve the code in any way.
> For example, with wrappers:{code}    Resource normalized = 
> Resources.normalize(
>         resourceCalculator, ask, minimumResource,
>         maximumResource, incrementResource);
> {code} and without wrappers:{code}    Resource normalized = 
> resourceCalculator.normalize(ask, minimumResource,
>         maximumResource, incrementResource);{code}
> The difference isn't huge, but I find the latter much more readable.  With 
> the former I always have to figure out which parameters are which, because 
> passing in the {{ResourceCalculator}} adds in an unrelated additional 
> parameter at the head of the list.
> There may be some cases where the wrapper methods are mixed in with calls to 
> legitimate {{Resources}} methods, making the code more consistent to use the 
> wrappers. In those cases, that may be a reason to keep and use the wrapper 
> method.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to