[
https://issues.apache.org/jira/browse/HDFS-13598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yiqun Lin updated HDFS-13598:
-----------------------------
Description:
Every time we invoke {{INodesInPath#toString()}}, we will trigger one time
byte-to-string transform operation.
{code:java}
private String toString(boolean vaildateObject) {
if (vaildateObject) {
validate();
}
final StringBuilder b = new StringBuilder(getClass().getSimpleName())
.append(": path = ").append(DFSUtil.byteArray2PathString(path))
.append("\n inodes = ");
...
}
{code}
But actually we only need to do at most one time. In {{INodesInPath}}, it has
defined one String type variable named {{pathname}} for storing the path string
value. Here we can use {{getPath()}} to replace
{{DFSUtil.byteArray2PathString(path)}}.
was:
Every time we invoke {{INodesInPath#toString()}}, we will trigger one time
byte-to-string transform operation.
{code:java}
private String toString(boolean vaildateObject) {
if (vaildateObject) {
validate();
}
final StringBuilder b = new StringBuilder(getClass().getSimpleName())
.append(": path = ").append(DFSUtil.byteArray2PathString(path))
.append("\n inodes = ");
...
}
{code}
But actually we only need to do at most one time. In {{INodesInPath}}, it has
defined one String type variable named {{pathname}} for storing the path string
value. Here we can use {{getPath()}} to to replace
{{DFSUtil.byteArray2PathString(path)}}.
> Reduce unnecessary byte-to-string transform operation in INodesInPath#toString
> ------------------------------------------------------------------------------
>
> Key: HDFS-13598
> URL: https://issues.apache.org/jira/browse/HDFS-13598
> Project: Hadoop HDFS
> Issue Type: Improvement
> Affects Versions: 3.1.0
> Reporter: Yiqun Lin
> Priority: Minor
>
> Every time we invoke {{INodesInPath#toString()}}, we will trigger one time
> byte-to-string transform operation.
> {code:java}
> private String toString(boolean vaildateObject) {
> if (vaildateObject) {
> validate();
> }
> final StringBuilder b = new StringBuilder(getClass().getSimpleName())
> .append(": path = ").append(DFSUtil.byteArray2PathString(path))
> .append("\n inodes = ");
> ...
> }
> {code}
> But actually we only need to do at most one time. In {{INodesInPath}}, it has
> defined one String type variable named {{pathname}} for storing the path
> string value. Here we can use {{getPath()}} to replace
> {{DFSUtil.byteArray2PathString(path)}}.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]