Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed Improvement through less looping #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Skipants
Copy link

@Skipants Skipants commented Nov 9, 2023

By flattening the loop and only doing YARD parsing once per different list of paths (model vs. controller) we see a significant speedup.

Here's the stats

Before fix:
   bundle exec rails swagger_yard:generate --trace  190.84s user 2.28s system 99% cpu 3:14.88 total
➜ monolith-app ✔ wc artifacts/openapi.json
   10810   23440  317305 artifacts/openapi.json

After fix:
bundle exec rails swagger_yard:generate --trace  6.68s user 1.33s system 92% cpu 8.637 total
➜ monolith-app ✔ wc artifacts/openapi.json
   10810   23440  317305 artifacts/openapi.json

swagger_yard:generate is our rake task that builds the spec and outputs the openapi file to artifacts/openapi.json.
I use wc artifacts/openapi.json to test that the generation is the same.

By flattening the loop and only doing YARD parsing once per different list of paths (model vs. controller) we see a significant speedup.
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.

1 participant