[
https://issues.apache.org/jira/browse/HBASE-26032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wei-Chiu Chuang updated HBASE-26032:
Description:
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.
I suggest we should return the stores object directly, an O( 1 ) operation.
was:
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.
> 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
>Priority: Minor
> 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.
> I suggest we should return the stores object directly, an O( 1 ) operation.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)