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

[2.x] Massive Windows performance improvement of the Vite integration #2021

Merged
merged 5 commits into from
Nov 15, 2024

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Nov 14, 2024

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:

Restructuring Vite configuration:

  • vite.config.js: Introduced a new hydeVitePlugin to 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 dev manually instead of through php hyde serve --vite we now only have a ~0.035ms delay for each page preview.

Starting/stopping the Vite server brings a tiny performance impact, which is negligible in this context:

Signal Handler Setup: 0.23ms

  VITE v5.4.10  ready in 840 ms

  ➜  Local:   http://127.0.0.1:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
Cleanup Operation: 0.981ms

This means the new setup is about 99.965% or ~2857 times faster for individual page previews.

@caendesilva caendesilva mentioned this pull request Nov 14, 2024
14 tasks
@caendesilva caendesilva marked this pull request as draft November 14, 2024 20:22
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (ec1583a) to head (18ccd6b).
Report is 6 commits behind head on new-asset-system.

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.
📢 Have feedback on the report? Share it here.

@caendesilva caendesilva changed the title Improve performance of the Vite integration Massive Windows performance improvement of the Vite integration Nov 15, 2024
@caendesilva caendesilva marked this pull request as ready for review November 15, 2024 09:45
@caendesilva caendesilva merged commit 9e1c2df into new-asset-system Nov 15, 2024
12 checks passed
@caendesilva caendesilva deleted the vite-integration branch November 15, 2024 09:45
@caendesilva caendesilva mentioned this pull request Nov 15, 2024
87 tasks
@caendesilva caendesilva changed the title Massive Windows performance improvement of the Vite integration [2.x] Massive Windows performance improvement of the Vite integration Nov 16, 2024
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.

1 participant