Skip to content

Conversation

@cosmastech
Copy link
Contributor

@cosmastech cosmastech commented Nov 4, 2025

Building off of #57623

This change has two benefits:

  1. We cache the Application@configurationIsCached() check, so this will benefit anyone running the app to reduce unnecessary repeated file_exists() for the cached config. This has been moved into its own PR: [12.x] Cache the result of configurationIsCached() #57665
  2. Creates a testing trait for caching the configuration for all tests

On our pipeline, I observed the following:

  • Original: 07.52.903
  • WithCachedRoutes: 05:41.584
  • WithCachedRoutes and WithCachedConfig: 04:28.769 🤯

@cosmastech cosmastech marked this pull request as draft November 4, 2025 12:41
@cosmastech cosmastech marked this pull request as ready for review November 5, 2025 22:52
{
$app->instance('config_loaded_from_cache', true); // I'm not sure this is actually needed

LoadConfiguration::setAlwaysUseConfig(static fn () => CachedState::$cachedConfig);
Copy link
Contributor Author

@cosmastech cosmastech Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any concern here about someone storing an object in cache that can be modified between tests? We could serialize/unserialize it on each test. This would cost some CPU cycles for each test, but could insulate us from that problem. Not sure how often people are storing mutable objects in their configurations 🤔

@taylorotwell taylorotwell merged commit cafe1ac into laravel:12.x Nov 7, 2025
66 checks passed
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