-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
feat: improve performance #2626
Conversation
Looking at CI |
Codecov Report
@@ Coverage Diff @@
## master #2626 +/- ##
==========================================
- Coverage 95.23% 95.19% -0.05%
==========================================
Files 31 30 -1
Lines 1512 1499 -13
Branches 429 428 -1
==========================================
- Hits 1440 1427 -13
Misses 72 72
Continue to review full report at Codecov.
|
Looks like some spacing diff in help output |
Try a rebase. |
hm looks like no help |
@@ -4,7 +4,7 @@ const { run, hyphenToUpperCase } = require('../../utils/test-utils'); | |||
const CLI = require('../../../packages/webpack-cli/lib/index'); | |||
|
|||
const cli = new CLI(); | |||
const optimizationFlags = cli.getBuiltInOptions().filter(({ name }) => name.startsWith('optimization-')); | |||
const optimizationFlags = Object.values(cli.getBuiltInOptions().coreFlags).filter(({ name }) => name.startsWith('optimization-')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Util func?
@@ -316,7 +316,7 @@ class WebpackCLI { | |||
return this.builtInOptionsCache; | |||
} | |||
|
|||
const minimumHelpFlags = [ | |||
const minimumHelpFlags = new Set([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perf here would have such little impact that there's no point. If there is 10000 objects I understand, but this is Max 30, so O(30ns) vs O(30^2) wouldnt make much difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we did a lookup for every flag, there could be ~300 flags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we should reduce number of Object.entries
/Object.values
/Object.keys
/etc
For example we can use this for help:
Object.entries(minimumHelpFlags).forEach(([name, meta]) => {
options[name].helpLevel = 'minimum';
});
So we avoid unnecessary looping over 1k options
Found more places to improve perf, I will finish it |
Big thanks! 👍 |
What kind of change does this PR introduce?
performance
Did you add tests for your changes?
existing
If relevant, did you update the documentation?
NA
Summary
Does this PR introduce a breaking change?
no
Other information