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

Ivan Andika updated HDDS-12822:
-------------------------------
    Description: 
Currently OmKeyInfo#isKeyInfoSame compares the OmKeyInfo objectID last, 
although objectID is one of the most likely changed attribute. Ideally, the 
equality check should compare the attributes that are most likely changed first 
so that the results can be short-circuited faster.

We can also prioritize the equality based on the data types. We can rank from 
the fastest to lowest
 # Primitives: Using == operator will use direct value comparison which should 
be fastest
 ## boolean: Simple true/false comparsion
 ## byte, char, short, int, long: direct comparsions
 ## float and double: floating-point checks which requires more calculation
 # Reference types
 ## String: Might be faster if we intern the string + the string differs early 
in the comparison
 ## Other objects: Depends on the complexity of the object equals() command
 # Collections and complex objects
 ## List (dynamic list like ACLs)
 ## Maps: We can differentiate between immutable map (key metadata) and mutable 
map (tags)
 ## Other complex objects

We can try to change the ordering of OmKeyInfo#isKeyInfoSame and run some 
micro-benchmarks (e.g. using JMH) to see the performance improvement.

  was:
Currently OmKeyInfo#isKeyInfoSame compares the OmKeyInfo objectID last, 
although objectID is one of the most likely changed attribute. Ideally, the 
equality check should compare the attributes that are most likely changed first 
so that the results can be short-circuited faster. We can also prioritize 
primitives (int, long) attributes first, then string, then list (dynamic list 
like ACLs), and finally maps (immutable map like metadata should comes before 
mutable map like tags).

We can try to change the ordering of OmKeyInfo#isKeyInfoSame and run some 
micro-benchmarks (e.g. using JMH) to see the performance improvement.


> Short-circuit in OmKeyInfo equality check
> -----------------------------------------
>
>                 Key: HDDS-12822
>                 URL: https://issues.apache.org/jira/browse/HDDS-12822
>             Project: Apache Ozone
>          Issue Type: Improvement
>            Reporter: Ivan Andika
>            Assignee: Ivan Andika
>            Priority: Major
>
> Currently OmKeyInfo#isKeyInfoSame compares the OmKeyInfo objectID last, 
> although objectID is one of the most likely changed attribute. Ideally, the 
> equality check should compare the attributes that are most likely changed 
> first so that the results can be short-circuited faster.
> We can also prioritize the equality based on the data types. We can rank from 
> the fastest to lowest
>  # Primitives: Using == operator will use direct value comparison which 
> should be fastest
>  ## boolean: Simple true/false comparsion
>  ## byte, char, short, int, long: direct comparsions
>  ## float and double: floating-point checks which requires more calculation
>  # Reference types
>  ## String: Might be faster if we intern the string + the string differs 
> early in the comparison
>  ## Other objects: Depends on the complexity of the object equals() command
>  # Collections and complex objects
>  ## List (dynamic list like ACLs)
>  ## Maps: We can differentiate between immutable map (key metadata) and 
> mutable map (tags)
>  ## Other complex objects
> We can try to change the ordering of OmKeyInfo#isKeyInfoSame and run some 
> micro-benchmarks (e.g. using JMH) to see the performance improvement.



--
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