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: use finishModules #73

Merged
merged 9 commits into from
Feb 4, 2021
Merged

Conversation

ricardogobbosouza
Copy link
Collaborator

@ricardogobbosouza ricardogobbosouza commented Feb 1, 2021

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

Use the hook finishModules to lint more files and not one by one

Resolve #70

Breaking Changes

Additional Info

@codecov
Copy link

codecov bot commented Feb 1, 2021

Codecov Report

Merging #73 (439b383) into master (8a72a8a) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #73   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          243       250    +7     
  Branches        65        70    +5     
=========================================
+ Hits           243       250    +7     
Impacted Files Coverage Δ
src/index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a72a8a...9af93fa. Read the comment docs.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Let's add test, should be not hard, because we can spy eslint

@ricardogobbosouza
Copy link
Collaborator Author

/cc @alexander-akait

alexander-akait
alexander-akait previously approved these changes Feb 3, 2021
@watjurk
Copy link

watjurk commented Feb 4, 2021

I think that using "outside set" and checking if file is in this set is kind of performance issue, as finishModules hook is called only once we can came with better solution:

const resources = Array.from(modules)
          // @ts-ignore
          .filter((module) => module.resource)
          // @ts-ignore
          .map(({ resource }) => resource.split('?')[0])
          .filter((resource) => resource /* && !seen.has(resource) */ && isMatch(resource, wanted) && !isMatch(resource, exclude));
const resourcesUnique = new Set(resources);
//...

src/index.js Outdated Show resolved Hide resolved
@ricardogobbosouza ricardogobbosouza merged commit 19fa551 into master Feb 4, 2021
@ricardogobbosouza ricardogobbosouza deleted the pref-use-finish-modules branch February 4, 2021 21:46
@jsg2021
Copy link
Contributor

jsg2021 commented Feb 11, 2021

By moving the finishModule hook we no longer spread the linting work out... one lump (in my case 5620 files) gets sent to the linter in one go. The thread pool (if threaded) does not fill up... only one worker gets all the jobs.

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.

The same file is being linted multiple times during a compilation, causing very long build times
4 participants