alluxio icon indicating copy to clipboard operation
alluxio copied to clipboard

Improve PathUtils.findLowestCommonAncestor to save memory

Open shuaiwuyue opened this issue 2 years ago • 2 comments

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

shuaiwuyue avatar Apr 25 '22 09:04 shuaiwuyue

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.

alluxio-bot avatar Apr 25 '22 09:04 alluxio-bot

You did it @shuaiwuyue!

Thank you for signing the Contribution License Agreement.

alluxio-bot avatar May 10 '22 04:05 alluxio-bot

alluxio-bot, merge this please

jiacheliu3 avatar Oct 12 '22 10:10 jiacheliu3