Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Optimising Composer Autoloader #16881

Closed
Bakual opened this issue Jun 27, 2017 · 5 comments
Closed

[4.0] Optimising Composer Autoloader #16881

Bakual opened this issue Jun 27, 2017 · 5 comments

Comments

@Bakual
Copy link
Contributor

Bakual commented Jun 27, 2017

Honestly I have no clue if we do that already or not or if it is even something we should or could do.
I just stumbled over the composer option optimize-autoloader (see https://getcomposer.org/doc/articles/autoloader-optimization.md). According to that doc this option should be activated for production enviroments as it speeds things up quite a bit.

What do you composer savvy guys think?

@mbabker
Copy link
Contributor

mbabker commented Jun 27, 2017

It might be better off in 4.0 than 3.x. Honestly the only difference it makes as it relates to code is it adds each class individually to the class maps in Composer's autoload_classmap.php and autoload_static.php files, so when PHP has to get into the autoloader Composer will check that map first then fall back into scanning the filesystem based on the namespace. So for our uses right now, the performance gain is probably negligible, but in a proper Symfony or Laravel based project which is entirely Composer driven it can make a world of difference.

@laoneo
Copy link
Member

laoneo commented Jun 28, 2017

As we have only external packages loaded trough composer, guess it will be worth a try to run it in optimized mode.

@Bakual
Copy link
Contributor Author

Bakual commented Jun 28, 2017

From https://getcomposer.org/doc/articles/autoloader-optimization.md#trade-offs:

There are no real trade-offs with this method. It should always be enabled in production.

So from what I understand, Level 1 optimisation should be done as there is no reason not to do it. Level 2 is another topic and doesn't look like suitable for us.

@laoneo
Copy link
Member

laoneo commented Jun 28, 2017

I was playing around with it and it creates bigger classmap files. Created a pr for it #16896. I think it is worth to enable it, even tough in staging the impact will be little, but in J4, where we have more libs installed, we will get some improvements.

@zero-24
Copy link
Contributor

zero-24 commented Jun 28, 2017

Closing as we have a PR :)

@zero-24 zero-24 closed this as completed Jun 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants