Closed mattbrictson closed 1 year ago
In a Rails app with a large number of images and stylesheets
Makes sense! Thanks!
Disabling auto_build
in the CI would bail the check early before attempting a socket connection, so hadn't noticed it.
This will make the development server check a bit less responsive, but it should be fine in practice.
Description đ
This pull request speeds up performance considerably in local test environments by reducing the frequency of the dev server check when the dev server is not running.
Background đ
The comment for the
dev_server_running?
method says:However, in reality that is only true with the dev server is running.
When the dev server is not running, no timestamp is recorded. That means that the dev server check is performed with every manifest lookup.
The Fix đ¨
Store a timestamp in
@running_checked_at
regardless of whether the dev server check succeeds or fails. This ensures that the dev server check is done at most once per second, even if the dev server is not running.Screenshots đˇ
In a Rails app with a large number of images and stylesheets (i.e. many manifest lookups per page), this patch resulted in an 18x performance improvement when running system specs.
Before:
After: