You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Duo Zhang (Jira)" <ji...@apache.org> on 2025/01/18 02:28:00 UTC
[jira] [Resolved] (HBASE-29004) Optimize unnecessary type castings in Scan and Get setter methods
[ https://issues.apache.org/jira/browse/HBASE-29004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Duo Zhang resolved HBASE-29004.
-------------------------------
Fix Version/s: 2.7.0
3.0.0-beta-2
2.5.11
2.6.2
Hadoop Flags: Reviewed
Resolution: Fixed
Merged to all active branches.
Thanks [~chandrasekhar.k] for contributing!
> Optimize unnecessary type castings in Scan and Get setter methods
> -----------------------------------------------------------------
>
> Key: HBASE-29004
> URL: https://issues.apache.org/jira/browse/HBASE-29004
> Project: HBase
> Issue Type: Improvement
> Components: Performance
> Reporter: Chandra Sekhar K
> Assignee: Chandra Sekhar K
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.7.0, 3.0.0-beta-2, 2.5.11, 2.6.2
>
>
> In the setter methods of Scan and Get, we invoke the super class method, type cast and return the object.
> {code:java}
> public Scan setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) {
> return (Scan) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
> }{code}
>
> In profiler reports it's observed that this typecasting does take some additional cpu cycles. we can optimize this by adding an explicit return statement with current object.
> {code:java}
> public Scan setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) {
> super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
> return this;
> }{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)