Skip to content

Sloooooow object return #56

Description

@ThePoShWolf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions