You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Wei-Chiu Chuang (Jira)" <ji...@apache.org> on 2021/06/25 02:07:00 UTC

[jira] [Created] (HBASE-26032) Make HRegion.getStores() an O(1) operation

Wei-Chiu Chuang created HBASE-26032:
---------------------------------------

             Summary: Make HRegion.getStores() an O(1) operation
                 Key: HBASE-26032
                 URL: https://issues.apache.org/jira/browse/HBASE-26032
             Project: HBase
          Issue Type: Improvement
            Reporter: Wei-Chiu Chuang
            Assignee: Wei-Chiu Chuang
         Attachments: Screen Shot 2021-06-24 at 3.56.33 PM.png

This is a relatively minor issue, but I did spot HRegion.getStores() popping up in my profiler.

Checking the code, I realized that HRegion.getStores() allocates a new array list in it, converting the Collection<> to List<>. But it also makes it an O( n ) in space and time complexity.

This conversion appears mostly unnecessary, because we only iterate the stores in production code, and so the new ArrayList object is thrown away immediately. Only in a number of test code where we index into the stores.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)