You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@fluo.apache.org by keith-turner <gi...@git.apache.org> on 2017/04/24 15:02:18 UTC

[GitHub] incubator-fluo issue #826: Avoid using bytesAt() internally in Bytes

GitHub user keith-turner opened an issue:

    https://github.com/apache/incubator-fluo/issues/826

    Avoid using bytesAt() internally in Bytes

    I noticed that multiple methods inside Bytes use the `byteAt` method in loops.  It would be more efficient to access the array directly because `byteAt` does sanity checks for each access.  It would better to sanity check the entire range before the loop and directly access the array inside the loop.  This improvement could be made to at least the following methods : `hashCode()` and `compareTo`.
    


----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-fluo issue #826: Avoid using bytesAt() internally in Bytes

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the issue at:

    https://github.com/apache/incubator-fluo/issues/826


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-fluo issue #826: Avoid using bytesAt() internally in Bytes

Posted by keith-turner <gi...@git.apache.org>.
Github user keith-turner commented on the issue:

    https://github.com/apache/incubator-fluo/issues/826
  
    Can also avoid continually adding the offsets by doing it once outside the loops.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-fluo issue #826: Avoid using bytesAt() internally in Bytes

Posted by cjmctague <gi...@git.apache.org>.
Github user cjmctague commented on the issue:

    https://github.com/apache/incubator-fluo/issues/826
  
    @keith-turner Could we use the java helper methods like `Objects.hashCode(this);`for `hashCode()`  in Bytes like is used in the rest of the API?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-fluo issue #826: Avoid using bytesAt() internally in Bytes

Posted by keith-turner <gi...@git.apache.org>.
Github user keith-turner commented on the issue:

    https://github.com/apache/incubator-fluo/issues/826
  
    > Could we use the java helper methods like Objects.hashCode(this);for hashCode() in Bytes like is used in the rest of the API?
    
    @cjmctague if you can find something.  I couldn't find a built in java method that takes an offset and length.  Java has `Arrays.hashCode(byte[])`, but to use this we would need to create a new byte array and copy to it.  Too bad java doesn't have ``Arrays.hashCode(byte[] data, int offset, int len)`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---