- Notifications
You must be signed in to change notification settings - Fork163
Optimize bootstrap.php.cache#272
Uh oh!
There was an error while loading.Please reload this page.
Conversation
stof commentedJul 4, 2016
This will be wrong, as some classes may already have been loaded before including bootstrap.php.cache, and this would lead to double declaration of classes |
nicolas-grekas commentedJul 6, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I don't think this argument applies here: |
nicolas-grekas commentedJul 6, 2016
I forgot to write it but we should also consider that the list of classes we're talking about is hard coded. Thus, any of the listed classes were intended for inlining. |
stof commentedJul 6, 2016
does it actually change anything for bootstrap.php.cache ? This file is not created in an adaptive way, and so is not impacted by declared classes |
nicolas-grekas commentedJul 6, 2016
One class is re-inlined by this fix currently: ClassCollectionLoader itself. |
stof commentedJul 6, 2016
this looks weird to me. It means that the file is always adaptive. |
nicolas-grekas commentedJul 6, 2016
It is, but bootstrapping is a complex topic :) |
nicolas-grekas commentedJul 10, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Updated: the list of classes is too large. I reduced it to classes that are needed before kernel booting. |
fabpot commentedJul 10, 2016
"The list of classes is too large" -> what's the consequence? |
nicolas-grekas commentedJul 10, 2016
This is a matter of responsibility, to where this stops and delegates to the "addClassesToCompile" mechanism. Practically, all classes listed here should be listed in linked PR for exclusion as well. The shorter the list, the easier the sync in the long run. |
…enerate inlined-classes files (nicolas-grekas)This PR was squashed before being merged into the 3.2-dev branch (closes#19276).Discussion----------[ClassLoader] Add ClassCollectionLoader::inline() to generate inlined-classes files| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -Unfortunately, can't be tested because the method relies too much on side effects.Coupled withsensiolabs/SensioDistributionBundle#272, allows inlining `ClassCollectionLoader` itself into the `bootstrap.php.cache` file.Commits-------88fdcea [ClassLoader] Add ClassCollectionLoader::inline() to generate inlined-classes files
…enerate inlined-classes files (nicolas-grekas)This PR was squashed before being merged into the 3.2-dev branch (closes #19276).Discussion----------[ClassLoader] Add ClassCollectionLoader::inline() to generate inlined-classes files| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -Unfortunately, can't be tested because the method relies too much on side effects.Coupled withsensiolabs/SensioDistributionBundle#272, allows inlining `ClassCollectionLoader` itself into the `bootstrap.php.cache` file.Commits-------88fdcea [ClassLoader] Add ClassCollectionLoader::inline() to generate inlined-classes files
nicolas-grekas commentedJul 31, 2016
ping@fabpot , this one needs to be merged to make the standard edition work |
fabpot commentedJul 31, 2016
Is it BC with older versions of Symfony? |
nicolas-grekas commentedJul 31, 2016
Yes it should: less classes inlined. And the method_exists check. |
nicolas-grekas commentedJul 31, 2016
Just confirmed with a symfony-standard 2.7: runs just fine with this patch. |
nicolas-grekas commentedAug 17, 2016
ping@fabpot |
| 'Symfony\\Component\\HttpKernel\\Kernel', | ||
| 'Symfony\\Component\\ClassLoader\\ClassCollectionLoader', | ||
| 'Symfony\\Component\\ClassLoader\\ApcClassLoader', | ||
| 'Symfony\\Component\\HttpKernel\\Bundle\\Bundle', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Bundle and Container are necessary before booting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
And they are inlined, but by the kernel, not this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
but this is too late, because the kernel loads the bundle to be able to build the list of compiled classes (as it asks bundles for them), so the class is already used before that
nicolas-grekasAug 17, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nope: the kernel does this in two stages. First generate classes.map after boot, then classes.php at next bootstrap (or with a broken cache warmer on 3.1, fixed in master, see linked PR). Thus it works well and the Bundle doesn't need to be here to be inlined.
nicolas-grekas commentedSep 3, 2016
Any blocker here? |
Composer/ScriptHandler.php Outdated
| * @param Event $event The command event. | ||
| * @param string$actionName The name of the action | ||
| * @param Event$event The command event. | ||
| * @param string $actionName The name of the action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you please revert this two-lines cs fix? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
reverted
HeahDude commentedSep 5, 2016
Thank you@nicolas-grekas |
Related tosymfony/symfony#19276