alluxio
alluxio copied to clipboard
Improve PathUtils.findLowestCommonAncestor to save memory
What changes are proposed in this pull request?
An ArrayList that will eventually be converted to an Array is used to hold the common components in PathUtils.findLowestCommonAncestor()
. It is better to use Array because the length of ArrayList is fixed in the method.
Why are the changes needed?
ArrayList.toArray()
dose a copy. Using Array can reduce one copy if we know very well how many elements there are.
Does this PR introduce any user facing changes?
NA
Hi @shuaiwuyue, thanks for your contribution!
In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes.
You did it @shuaiwuyue!
Thank you for signing the Contribution License Agreement.
alluxio-bot, merge this please