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
Don't regenerate if input files are older than output file (take 2) #14078
Conversation
Codecov Report
@@ Coverage Diff @@
## main #14078 +/- ##
==========================================
- Coverage 52.21% 51.28% -0.93%
==========================================
Files 1554 1524 -30
Lines 79363 77125 -2238
Branches 7085 6903 -182
==========================================
- Hits 41439 39555 -1884
+ Misses 34178 33998 -180
+ Partials 3746 3572 -174
|
const generateOperations = {} | ||
for (const outfile of Object.keys(allGenerateOperations)) { | ||
const inputs = allGenerateOperations[outfile].documents | ||
if (watch || (await isInputNewer(inputs, outfile))) { |
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.
If we always include everything in watch
mode, does this still have any improvement for ./dev/start.sh
? Since in ./dev/start.sh
we're always watching, no?
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.
When dev/start.sh
is run, both the non-watch and watch invocation are run in serial. AFAICT the watch run does not actually regenerate until a file has changed (which is why the non-watch invocation is necessary).
Empirically, yes, this shaves at least 10s off for me.
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.
I think the watch
mode - at least of the GraphQL codegen - actually does run an initial build. If that is correct an even better optimization could actually be to remove the initial, serial, one-time codegen 🤔
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.
Addressed in d985b46. Incidentally, this is already done in web/gulpfile.js
, so I just copied that.
e5bf7d0
to
65d8381
Compare
65d8381
to
18b93a1
Compare
@@ -29,7 +29,11 @@ const build = gulp.series(generate, webWebpack) | |||
/** | |||
* Watches everything and rebuilds on file changes. | |||
*/ | |||
const dev = gulp.parallel(watchGenerate, webWebpackDevServer) | |||
const dev = gulp.series( |
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 want to wait for the initial generate steps to complete before running the webpack dev server for 2 reasons:
- The generated files may be missing when the the webpack dev server expects them to exist, causing errors to be printed.
- The generate steps will immediately update the generated files, causing webpack dev server to immediately recompile before its first compilation is complete, wasting CPU cycles for no observable improvement in time-to-ready
First commit is what was pushed in #13782, second commit fixes #14039.
Empirically, this improves time-to-user-readiness for
enterprise/dev/start.sh
from 40-45s to 32-36s.