Closed
Description
Change arrays to ArrayLists to drastically improve performance
Arrays in PowerShell are of fixed length at creation, as such, using the += operator to append an element to the array causes the entire array to be rebuilt in memory. This significantly increases the time complexity of the append operation, from O(1) to O(n).
Switching data structures from Arrays to ArrayLists would solve this issue, reducing the time complexity down to O(1), while leaving the memory space complexity roughly the same, where as using a HashTable would increase the space used to store the data structure.
Metadata
Metadata
Assignees
Labels
No labels