[
https://issues.apache.org/jira/browse/HDFS-13428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16434236#comment-16434236
]
Íñigo Goiri commented on HDFS-13428:
------------------------------------
Thanks [~belugabehr] for the patch.
Can you point to some link for the speed for iterating {{ArrayList}} vs
{{LinkedList}}?
I believe that would be the case specially given it will allocate a continuous
block of memory but just for reference.
Out of curiosity, your changes are mostly optimizations in using data
structures in kind of random places across HDFS; are you doing some static
analysis through the code?
In any case, [^HDFS-13428.1.patch] LGTM. +1
I'll commit this during the day.
> RBF: Remove LinkedList From StateStoreFileImpl.java
> ---------------------------------------------------
>
> Key: HDFS-13428
> URL: https://issues.apache.org/jira/browse/HDFS-13428
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: federation
> Affects Versions: 3.0.1
> Reporter: BELUGA BEHR
> Assignee: BELUGA BEHR
> Priority: Trivial
> Attachments: HDFS-13428.1.patch
>
>
> Replace {{LinkedList}} with {{ArrayList}} implementation in the
> StateStoreFileImpl class. This is especially advantageous because we can
> pre-allocate the internal array before a copy occurs. {{ArrayList}} is
> faster for iterations and requires less memory than {{LinkedList}}.
> {code:java}
> protected List<String> getChildren(String path) {
> List<String> ret = new LinkedList<>();
> File dir = new File(path);
> File[] files = dir.listFiles();
> if (files != null) {
> for (File file : files) {
> String filename = file.getName();
> ret.add(filename);
> }
> }
> return ret;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]