Closed erfanimani closed 4 years ago
Will test for a while with the following in deploy.php, and report back.
set('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --no-suggest'); // Removing optimization from here, since we're now doing it separately.
task('optimize-autoloader', function () {
run('cd {{release_path}} && {{bin/composer}} dump-autoload --optimize --apcu');
});
after('files:compile', 'optimize-autoloader');
Can you create a PR @erfanimani ?
I like the idea!
Yes, it works good. Haven't benchmarked it, but I'll create a pr when I get the chance.
@erfanimani Did you ever get round to benchmarking this? Very curious to see what impact this has.
@stu177 I just created a PR, but haven't actually benchmarked it. @IvanChepurnyi might know
See this Blackfire profiles: https://twitter.com/IvanChepurnyi/status/1179318211076087808 When autoload is dumped before compile step - composer will execute file_exists check on every auto-generated class resolving in huge I/O hit.
I haven't tested it, but apparently
composer dumpautoload -o --apcu
can be run after DI compile to speed up PHP class lookups. Might be worth looking into.https://twitter.com/IvanChepurnyi/status/1179280000400465920