[
https://issues.apache.org/jira/browse/HBASE-15501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15204814#comment-15204814
]
Vladimir Rodionov commented on HBASE-15501:
-------------------------------------------
Estimated reduction in memory allocation rate on a client side during write -
4-5% (after HBASE-15479).
> MultiAction.add creates unnecessary temporary objects
> -----------------------------------------------------
>
> Key: HBASE-15501
> URL: https://issues.apache.org/jira/browse/HBASE-15501
> Project: HBase
> Issue Type: Improvement
> Components: Client
> Affects Versions: 2.0.0
> Reporter: Vladimir Rodionov
> Assignee: Vladimir Rodionov
> Fix For: 2.0.0
>
>
> MultiAction class:
> {code}
> /**
> * Add an Action to this container based on it's regionName. If the
> regionName
> * is wrong, the initial execution will fail, but will be automatically
> * retried after looking up the correct region.
> *
> * @param regionName
> * @param a
> */
> public void add(byte[] regionName, Action<R> a) {
> add(regionName, Arrays.asList(a));
> }
> /**
> * Add an Action to this container based on it's regionName. If the
> regionName
> * is wrong, the initial execution will fail, but will be automatically
> * retried after looking up the correct region.
> *
> * @param regionName
> * @param actionList list of actions to add for the region
> */
> public void add(byte[] regionName, List<Action<R>> actionList){
> List<Action<R>> rsActions = actions.get(regionName);
> if (rsActions == null) {
> rsActions = new ArrayList<Action<R>>(actionList.size());
> actions.put(regionName, rsActions);
> }
> rsActions.addAll(actionList);
> }
> {code}
> Avoid Arrays.asList(a) and Collection.addAll - they create temporary garbage
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)