Skip to content

Comments

perf: parallelize imports processing in import analysis plugin#12754

Merged
patak-dev merged 1 commit intomainfrom
perf/parallelize-imports-processing-in-import-analysis-plugin
Apr 6, 2023
Merged

perf: parallelize imports processing in import analysis plugin#12754
patak-dev merged 1 commit intomainfrom
perf/parallelize-imports-processing-in-import-analysis-plugin

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

@bolt-new-by-stackblitz
Copy link

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