Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 6, 2020. It is now read-only.

Optimize bootstrap.php.cache#272

Merged
HeahDude merged 1 commit intosensiolabs:masterfromnicolas-grekas:declared
Sep 5, 2016
Merged

Optimize bootstrap.php.cache#272

HeahDude merged 1 commit intosensiolabs:masterfromnicolas-grekas:declared
Sep 5, 2016

Conversation

@nicolas-grekas
Copy link
Contributor

@stof
Copy link
Contributor

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
Copy link
ContributorAuthor

nicolas-grekas commentedJul 6, 2016
edited
Loading

I don't think this argument applies here:ScriptHandler::doBuildBootstrap() is called in a composer plugin context, where the list of currently declared classes has nothing to do with the ones that may be declared whenbootstrap.php.cache will be included by the app.
The only way this works is based on an assumption: that is that thebootstrap.php.cache file is always included first or that the classes it declares won't collide with maybe preloaded classes. Not having this assumption in place would mean that things are broken by design.
A pragmatic argument that support this assumption is that SensioDistributionBundle is part of Symfony Standard Edtion and is by no mean meant for extensibility. That's whybootstrap.php.cache is and can be included first and unconditionally in e.g.app.php.

@nicolas-grekas
Copy link
ContributorAuthor

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
Copy link
Contributor

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
Copy link
ContributorAuthor

One class is re-inlined by this fix currently: ClassCollectionLoader itself.
Declared classes affect the result no matter what$adaptive is, seesymfony/symfony@a1031f6#diff-bc09f5d8b58e88e3a673386fdee7a981

@stof
Copy link
Contributor

stof commentedJul 6, 2016

this looks weird to me. It means that the file is always adaptive.

@nicolas-grekas
Copy link
ContributorAuthor

It is, but bootstrapping is a complex topic :)

@nicolas-grekasnicolas-grekas changed the titleInline more classes in bootstrap.php.cache by forcing an empty declared classes listOptimize bootstrap.php.cacheJul 10, 2016
@nicolas-grekas
Copy link
ContributorAuthor

nicolas-grekas commentedJul 10, 2016
edited
Loading

Updated: the list of classes is too large. I reduced it to classes that are needed before kernel booting.
All removed classes here are now listed in FrameworkExtension insymfony/symfony#19276

@fabpot
Copy link
Member

"The list of classes is too large" -> what's the consequence?

@nicolas-grekas
Copy link
ContributorAuthor

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.

fabpot added a commit to symfony/symfony that referenced this pull requestJul 18, 2016
…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
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull requestJul 18, 2016
…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
Copy link
ContributorAuthor

ping@fabpot , this one needs to be merged to make the standard edition work

@fabpot
Copy link
Member

Is it BC with older versions of Symfony?

@nicolas-grekas
Copy link
ContributorAuthor

Yes it should: less classes inlined. And the method_exists check.

@nicolas-grekas
Copy link
ContributorAuthor

Just confirmed with a symfony-standard 2.7: runs just fine with this patch.

@nicolas-grekas
Copy link
ContributorAuthor

ping@fabpot

'Symfony\\Component\\HttpKernel\\Kernel',
'Symfony\\Component\\ClassLoader\\ClassCollectionLoader',
'Symfony\\Component\\ClassLoader\\ApcClassLoader',
'Symfony\\Component\\HttpKernel\\Bundle\\Bundle',
Copy link
Contributor

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

Copy link
ContributorAuthor

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.

Copy link
Contributor

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

Copy link
ContributorAuthor

@nicolas-grekasnicolas-grekasAug 17, 2016
edited
Loading

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
Copy link
ContributorAuthor

Any blocker here?

* @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
Copy link
Contributor

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? :)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

reverted

@HeahDude
Copy link
Contributor

Thank you@nicolas-grekas

@HeahDudeHeahDude merged commita7227d7 intosensiolabs:masterSep 5, 2016
@nicolas-grekasnicolas-grekas deleted the declared branchSeptember 6, 2016 12:08
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@nicolas-grekas@stof@fabpot@HeahDude

[8]ページ先頭

©2009-2025 Movatter.jp