### Type of issue Missing information ### Feedback Knowing that PowerShell functions are quite expensive (see: https://stackoverflow.com/a/75722847/1701026) it is better to avoid recursion as per helpful [StackOverflow answer](https://stackoverflow.com/a/78354655/1701026) from @santisq: > The recommended approach would be to traverse your nested objects using a [`Stack`](https://learn.microsoft.com/en-us/dotnet/api/system.collections.stack?view=net-8.0) or [`Queue`](https://learn.microsoft.com/en-us/dotnet/api/system.collections.queue?view=net-8.0) (or their generic counterparts `Stack<T>` and `Queue<T>`). ### Page URL https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/performance/script-authoring-considerations?view=powershell-7.4 ### Content source URL https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/docs-conceptual/dev-cross-plat/performance/script-authoring-considerations.md ### Author @sdwheeler ### Document Id 9818d91b-8c5f-337a-f5e1-7a40abd5fd1a
Type of issue
Missing information
Feedback
Knowing that PowerShell functions are quite expensive (see: https://stackoverflow.com/a/75722847/1701026) it is better to avoid recursion as per helpful StackOverflow answer from Santiago Squarzon (@santisq):
Page URL
https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/performance/script-authoring-considerations?view=powershell-7.4
Content source URL
https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/docs-conceptual/dev-cross-plat/performance/script-authoring-considerations.md
Author
Sean Wheeler (@sdwheeler)
Document Id
9818d91b-8c5f-337a-f5e1-7a40abd5fd1a