You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Stephen O'Donnell (Jira)" <ji...@apache.org> on 2023/05/24 15:25:00 UTC

[jira] [Created] (HDDS-8682) EC: Avoid O(n) array.remove(element) when filtering pipelines in WritableECContainerProvider

Stephen O'Donnell created HDDS-8682:
---------------------------------------

             Summary: EC: Avoid O(n) array.remove(element) when filtering pipelines in WritableECContainerProvider
                 Key: HDDS-8682
                 URL: https://issues.apache.org/jira/browse/HDDS-8682
             Project: Apache Ozone
          Issue Type: Sub-task
          Components: SCM
            Reporter: Stephen O'Donnell
            Assignee: Stephen O'Donnell


When iterating over the pipeline list, if a pipeline is not valid for selection, we call Array.remove(element) to remove it from the list before selecting another random element.

If the pipeline selection policy could return the array index of the selected pipeline rather than the actual pipeline, then we can use the more efficient Array.remove(index). Even this is still O(n) as the array has to shuffle the elements down the internal array, but it is better than Array.remove(element) as it avoids searching for the element.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org