[2.x] Massive Windows performance improvement of the Vite integration#2021
Merged
emmadesilva merged 5 commits intonew-asset-systemfrom Nov 15, 2024
Merged
[2.x] Massive Windows performance improvement of the Vite integration#2021emmadesilva merged 5 commits intonew-asset-systemfrom
emmadesilva merged 5 commits intonew-asset-systemfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## new-asset-system #2021 +/- ##
====================================================
Coverage 100.00% 100.00%
+ Complexity 1907 1906 -1
====================================================
Files 195 195
Lines 5084 5078 -6
====================================================
- Hits 5084 5078 -6 ☔ View full report in Codecov by Sentry. |
emmadesilva
commented
Nov 15, 2024
a294c9d to
18ccd6b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Abstract
Follow up to #2016, to fix Windows performance with a much faster "hotfile" system like Laravel uses, instead of a slow socket connection test.
Details
This pull request includes changes to improve the performance and functionality of the Vite development server integration. The most important changes include replacing the Vite dev server check with a hot file check and restructuring the Vite configuration to manage the hot file lifecycle.
Improvements to Vite dev server integration:
packages/framework/src/Facades/Vite.php: Replaced the Vite dev server check with a more efficient hot file check to improve performance, especially on Windows.Restructuring Vite configuration:
vite.config.js: Introduced a newhydeVitePluginto handle the creation and removal of the Vite hot file when the server starts and stops, respectively. This ensures the hot file accurately reflects the server's state. [1] [2]Benchmark (Windows)
Instead of the the ~100ms delay on Windows when running
npm run devmanually instead of throughphp hyde serve --vitewe now only have a~0.035msdelay for each page preview.Starting/stopping the Vite server brings a tiny performance impact, which is negligible in this context:
This means the new setup is about 99.965% or ~2857 times faster for individual page previews.