Skip to content

[prism-cli] getHttpOperationsFromSpec performance regression #1860

@nulltoken

Description

@nulltoken

Describe the bug

Following APIDevTools/json-schema-ref-parser#211 by the amazing @P0lip everything was neat and nice running Prism 4.1.2.

We recently tried to bump to 4.3.1 but discovered a similar performance regression while running getHttpOperationsFromSpec()

To Reproduce

A complete standalone repro case is available at https://github.com/nulltoken/prism_repro

Running yarn repro against

$ yarn repro
yarn run v1.22.5
$ yarn node -r ts-node/register --unhandled-rejections=strict ./src/repro.ts
Running prism v4.1.2
Converting to Prism format: 330.432ms
Number of processed (basic) endpoints 600
Done in 4.71s.
$ yarn repro
yarn run v1.22.5
$ yarn node -r ts-node/register --unhandled-rejections=strict ./src/repro.ts
Running prism v4.3.1
Converting to Prism format: 27.135s
Number of processed (basic) endpoints 600
Done in 31.13s.

Expected behavior

Jumping from 330ms to 27s when processing the same file looks a bit much, doesn't it? 😉

Getting back to 330ms would be great.
And maybe adding a unit test to protect this method from suffering from new potential performance related regressions in the future ?

/cc @chohmann

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions