Skip to content

Conversation

@dballance
Copy link
Contributor

@dballance dballance commented Nov 29, 2017

Description

See #1150. Adds a 'per-patch' lookaside to the traverse method within createKeyBasedPlugin.

Motivation and Context

Previously, a $ref would be traversed multiple times during spec resolution. This change allows $refs to be resolved once and prevents future unnecessary revisits.

Fixes #1150 - but still some questions about handling allOf resolution that may be handled in another PR.

How Has This Been Tested?

All tests appear to pass - unsure if additional tests are required or need to be added for this change.

Existing code. Small spec (~5k lines formatted JSON). Average Resolution of ~1100ms.
image

With change. Average Resolution of ~250ms.
image

Existing code. Large spec (~141k lines formatted JSON). NOTE: allOf plugin disabled for the below tests - only running $ref plugin.
???? I couldn't actually get this to complete in any reasonable time. 😄

With change. Average Resolution of ~5200ms.
image

Types of changes

  • No code changes (changes to documentation, CI, metadata, etc)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@webron webron requested a review from shockey November 29, 2017 21:15
@shockey shockey added this to the December 1, 2017 milestone Nov 29, 2017
@shockey shockey merged commit 1bdb45a into swagger-api:master Nov 30, 2017
@shockey
Copy link
Contributor

shockey commented Dec 1, 2017

Thanks for this, @dballance! Very excited to ship this, I expect significant gains across the board for large definitions 😄

@shockey shockey mentioned this pull request Dec 9, 2017
10 tasks
shockey added a commit to shockey/swagger-js that referenced this pull request Dec 9, 2017
This reverts commit 1bdb45a, reversing
changes made to 66cff03.
@shockey shockey mentioned this pull request Dec 9, 2017
@lipnitsk lipnitsk mentioned this pull request Nov 6, 2021
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limiting DFS in createKeyBasedPlugin

2 participants