[ 
https://issues.apache.org/jira/browse/HDDS-6439?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Attila Doroszlai updated HDDS-6439:
-----------------------------------
    Fix Version/s: 1.3.0

> Minor perf optimization in the version enums
> --------------------------------------------
>
>                 Key: HDDS-6439
>                 URL: https://issues.apache.org/jira/browse/HDDS-6439
>             Project: Apache Ozone
>          Issue Type: Sub-task
>            Reporter: István Fajth
>            Assignee: Attila Doroszlai
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.3.0
>
>
> To avoid using values() all the time when the version is read from proto a 
> minor optimization was suggested in HDDS-6391, this JIRA is to track this.
> The suggestion:
> {code}
>   private static final Map<Integer, DatanodeVersion> BY_PROTO_VALUE =
>       Arrays.stream(DatanodeVersion.values())
>         .collect(toMap(DatanodeVersion::toProtoValue, identity()));
>   public static DatanodeVersion fromProtoValue(int value) {
>     return BY_PROTO_VALUE.getOrDefault(value, FUTURE_VERSION);
>   }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to