Hey! Great module, by the way.
I've only tested this with Get-OneLoginUser, but it appears that most of the cmdlets have the same issue.
Since Invoke-OneLoginRestMethod @Splat is wrapped in (), it enumerates all the return objects before converting them. This causes any pipeline actions to have to wait for the entire array of objects before doing anything, which kind of defeats the purpose of using the pipeline.
Is there a reason for this?
Here is a good example of the difference, this is the command without any modifications:
Measure-Command {Get-OneLoginUser -All | Select-Object -First 1}
On average, that was taking 25-30 seconds to complete in my environment, which was actually the same amount of time as without piping to Select-Object.
If I were to adjust line 60 to be:
Invoke-OneLoginRestMethod @Splat | ConvertTo-OneLoginObject -OutputType $OutputType
Then running the same command:
Measure-Command {Get-OneLoginUser -All | Select-Object -First 1}
Takes less than one second since Invoke-OneLoginRestMethod @Splat halts after passing the first object down the pipeline.
Hey! Great module, by the way.
I've only tested this with
Get-OneLoginUser, but it appears that most of the cmdlets have the same issue.Since
Invoke-OneLoginRestMethod @Splatis wrapped in(), it enumerates all the return objects before converting them. This causes any pipeline actions to have to wait for the entire array of objects before doing anything, which kind of defeats the purpose of using the pipeline.Is there a reason for this?
Here is a good example of the difference, this is the command without any modifications:
On average, that was taking 25-30 seconds to complete in my environment, which was actually the same amount of time as without piping to
Select-Object.If I were to adjust line 60 to be:
Then running the same command:
Takes less than one second since
Invoke-OneLoginRestMethod @Splathalts after passing the first object down the pipeline.