Symfony in a dev-environment is very slow, because each time it counts the container, writes a lot to the logs. If used in conjunction with Vagrant, which works very slowly with the file system in shared folders.
You can go to Ubuntu - everything will work there much faster. In production, too, everything works very fast.
In Windows + Vagrant, you can optimize - for example, move APP/var/cache
to /dev/shm/YourAppName/var/cache
. But it would be nice to have a container built in the files, because PhpStorm takes data from it for autocompletion and code validation. In my app/AppKernel.php
:
public function getCacheDir() { return $this->getVarOrShmDir('cache/' . $this->getEnvironment()); } public function getLogDir() { return $this->getVarOrShmDir('logs'); } private function getVarOrShmDir($dir) { $result = dirname(__DIR__) . '/var/' . $dir; if ( in_array($this->environment, ['dev', 'test'], true) && empty($_GET['warmup']) && // to force using real directory add ?warmup=1 to URL is_dir($result) && // first time create real directory, later use shm file_exists('/bin/mount') && shell_exec('mount | grep vboxsf') // only for VirtualBox ) { $result = '/dev/shm/' . 'YourAppName' . '/' . $dir . '/' . $this->getEnvironment(); } return $result; }
In php.ini
can make more use of the cache, not the disk:
realpath_cache_size = 4096k realpath_cache_ttl = 7200
You can disable Xdebug:
xdebug.remote_autostart=0 xdebug.remote_enable=0 xdebug.profiler_enable=0