Skip to content

Conversation

@emmadesilva
Copy link
Member

@emmadesilva emmadesilva 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.

@emmadesilva emmadesilva mentioned this pull request Nov 14, 2024
17 tasks
@emmadesilva emmadesilva marked this pull request as draft November 14, 2024 20:22
@codecov
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.

@emmadesilva emmadesilva changed the title Improve performance of the Vite integration Massive Windows performance improvement of the Vite integration Nov 15, 2024
@emmadesilva emmadesilva marked this pull request as ready for review November 15, 2024 09:45
@emmadesilva emmadesilva merged commit 9e1c2df into new-asset-system Nov 15, 2024
@emmadesilva emmadesilva deleted the vite-integration branch November 15, 2024 09:45
@emmadesilva emmadesilva 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.

2 participants