zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hosur Narahari (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (ZOOKEEPER-3058) Do length check first before actual byte check in compareBytes method of Utils class
Date Fri, 08 Jun 2018 16:40:00 GMT

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

Hosur Narahari updated ZOOKEEPER-3058:
--------------------------------------
    Description: In compareBytes method of org.apache.jute.Utils class, all the individual
bytes of 2 byte arrays are compared and then their lengths are compared. We can improve the
performance by first having length check, since we can rule out that they aren't equal by
a single if condition(O(1) operation) rather than looping through arrays(O( n ) operation).
 (was: In compareBytes method of org.apache.jute.Utils class, all the individual bytes of
2 byte arrays are compared and then their lengths are compared. We can improve the performance
by first having length check, since we can rule out that they aren't equal by a single if
condition(O(1) operation) rather than looping through arrays(O(n) operation).)

> Do length check first before actual byte check in compareBytes method of Utils class
> ------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-3058
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3058
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: jute
>            Reporter: Hosur Narahari
>            Priority: Minor
>
> In compareBytes method of org.apache.jute.Utils class, all the individual bytes of 2
byte arrays are compared and then their lengths are compared. We can improve the performance
by first having length check, since we can rule out that they aren't equal by a single if
condition(O(1) operation) rather than looping through arrays(O( n ) operation).



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

Mime
View raw message