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(nuxt): write templates in single sync step + improve logs #22384
Conversation
Run & review this pull request in StackBlitz Codeflow. |
} | ||
})) | ||
|
||
for (const write of writes) { write() } |
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.
AFAIK, using sync methods, blocks (our) main js render loop but it won't speed up v8 i/o threads. Have you tried with this new batching technique ++ async Promise.all
to see timing differences?
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've done some tests but the performance benefit I'm looking for here is reducing cascading hmr rather than reducing the time required to write the files.
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.
Yes, I understand that main point ππΌ But i suppose (native) HMR watchers are not in the same event loop of main javascript process we are writing files from (unless our receiver is sync again including vite). If either method is faster, it reduces final chance to have duplicate HMR events but if you already tried both, feel free to ignore this comment :)
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.
it may be an unnecessary optimisation. I tried both without appreciable time difference, and flagged up the fact that we are actually not watching the buildDir
with vite. I will have a look to see if we actually should be watching the directory. Not doing so might be causing some occasionally issues with vite-node cache, for example.
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 you have a good point here and we should definitely iterate on this. I'd be very open to rethinking this if you notice any issue..
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.
That makes sense to me, I think it's worth trying. Shall we better leave a comment inside to explain it's on purpose?
π Linked issue
β Type of change
π Description
This PR bundles three performance-focused improvements to template compilation and writing:
π Checklist