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

perf: parallelize imports processing in import analysis plugin #12754

Conversation

patak-dev
Copy link
Member

Description

Implement @sapphi-red's idea

I'm not seeing a perf improvement on Sapphi's test, but I think we should be able to find examples where this makes a difference.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@stackblitz
Copy link

stackblitz bot commented Apr 5, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Comment on lines +692 to +693
const acceptedUrls = mergeAcceptedUrls(orderedAcceptedUrls)
const acceptedExports = mergeAcceptedUrls(orderedAcceptedExports)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged after the Promise.all so these arrays are always ordered in the same way for each file. This isn't strictly needed but should help when debugging.

@patak-dev patak-dev added the performance Performance related enhancement label Apr 5, 2023
@sun0day
Copy link
Member

sun0day commented Apr 5, 2023

I'm not seeing a perf improvement on Sapphi's test, but I think we should be able to find examples where this makes a difference.

The maximum number of import statements in each file of sapphi's repo is 3-4, I think that's why. Double it, maybe it will make a difference.

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a file with many imports, I can see a small speed improvement of 21ms -> 19ms. And generally for other files, I can see a tiny reduction too. LGTM 👍

Note: speed tracked from debug logs for the import-analysis transform

@patak-dev patak-dev merged commit 037a6c7 into main Apr 6, 2023
@patak-dev patak-dev deleted the perf/parallelize-imports-processing-in-import-analysis-plugin branch April 6, 2023 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance related enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants