Skip to content

Commit 69b8082

Browse files
committed
Add a note about array addition
1 parent d836460 commit 69b8082

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

reference/docs-conceptual/dev-cross-plat/performance/script-authoring-considerations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ $results += Get-SomethingElse
113113
$results
114114
```
115115

116+
>[!NOTE] In PowerShell 7.5, array addition has been optimized and no longer creates a new array for each operation. The performance considerations described here should only be used in environments where PowerShell versions prior to 7.5 are in use. For more information, see [What's New in PowerShell 7.5](https://learn.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-75?view=powershell-7.5#engine-improvements).
117+
116118
Array addition is inefficient because arrays have a fixed size. Each addition to the array creates
117119
a new array big enough to hold all elements of both the left and right operands. The elements of
118120
both operands are copied into the new array. For small collections, this overhead may not matter.

0 commit comments

Comments
 (0)