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

[Translation] [FrameworkBundle] Translation: Optimized loading (lazy loading) of domains#2570

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

pulzarraider
Copy link
Contributor

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes (tests updated)
Fixes the following tickets: -

Website can have hundreds of messages in each domain. Some domains (and their translations) are not used during different requests (for example "admin" domain and their messages will not be used on public pages, "validation" domain will not be used until validating some entities/processing forms). This PR changes the way how messages are cached. Instead of storing all domains in one file (catalogue.en.php), domains are saved separately (/en/messages.php, /en/validators.php, etc.) and they are processing and loaded into memory only when they are required (to translate some text). This will optimize memory usage.

* @return Boolean
*
*/
public function hasDomain($domain);
Copy link
Member

Choose a reason for hiding this comment

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

We cannot add this method to this interface as it is marked with an@api tag.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Fixed, thanks.

@stof
Copy link
Member

stof commentedApr 4, 2012

@pulzarraider is this PR still valid ? If yes, please rebase your branch. It conflicts with master because of the move of the tests. If no, please close it

@pulzarraider
Copy link
ContributorAuthor

@stof Yes, it's valid. I will update it in the next few days.

Fixing CSFixing CSMinor optimalisationupdated unit tests for new dumpersresolve conflict with @api tagsfix CSTranslation domain loading memory optimalisationremoved unused variablefixed conflict
@pulzarraider
Copy link
ContributorAuthor

@stof Rebase done, conflicts fixed.

@Koc
Copy link
Contributor

Koc commentedApr 22, 2012

@stof /@fabpot , please, merge this PR

@stof
Copy link
Member

@Koc only@fabpot merges pull requests. Other core devs are only allowed to review them (even if github would let us push the button to merge them as there is no difference between the write access to the repo and the right to manage the issue tracker and to get notifications)

@sstok
Copy link
Contributor

Any new on this?

@stof
Copy link
Member

@fabpot should this PR be updated to be merged into 2.2 or do you think it should be rejected and closed ?

@litek
Copy link

I've been using the Translation component separately with Silex, so no integrated caching at all.

My solution was to create a CachedLoader wrapper. I'm not familiar with the inner workings of Symfony, but maybe that could work here as well? It would definitely be an improvement to the standalone translation component at least.

@fabpot
Copy link
Member

I'm not convinced that this has a real performance impact. It would help if we had some simple benchmarks.

@pulzarraider
Copy link
ContributorAuthor

@fabpot The performance and memory consumption will depend on the number of translations in those domains, that are not used in a request. If the number of translations is small, it's OK to let them together in one file, because effect on performance is negligible and searching+loading+compiling+executing file costs something, too. But it will change if there exist hundreds or thousands of translations in different domains.

For example, I find completely unnecessary to automatically load translations ofadmin domain and store them in memory because I know that they won't be used in frontend request (public webpage). They will be used only in backend request (admin section). It's waste of resources.

Maybe we can make compromise solution and let small domains to be cached together in one file (to avoid existence of many small files in cache) and bigger domains store in cache separately (each domain in one file). This will not help webpage with many translations wrapped into a lot of domains, but I think that such cases are not frequent.

Anyway, I will update this PR for latest Symfony version and create some benchmarks in the next recent days with different number of translations to be sure my PR will not slow down the framework.

@Koc
Copy link
Contributor

Koc commentedJan 17, 2014

@pulzarraider Can you continue work on the PR, please?

@pulzarraider
Copy link
ContributorAuthor

@Koc I am a bit busy atm, but I will continue working on this PR.

@wouterj
Copy link
Member

ping@pulzarraider

@jakzal
Copy link
Contributor

one more ping@pulzarraider ;)

@stof
Copy link
Member

ping again@pulzarraider

@pulzarraider
Copy link
ContributorAuthor

I will continue working on this PR next week.

@TobionTobion mentioned this pull requestFeb 13, 2015
@rvanlaak
Copy link
Contributor

A configurable threshold for merging smaller domains together would be great.

@ghost
Copy link

ping@pulzarraider

@nicolas-grekas
Copy link
Member

@aitboudad what do you think of this one?

@nicolas-grekas
Copy link
Member

OK you're on it, I just read the linked PR :)

@fabpot
Copy link
Member

Closing

@fabpotfabpot closed thisJan 25, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

11 participants
@pulzarraider@stof@Koc@sstok@litek@fabpot@wouterj@jakzal@rvanlaak@nicolas-grekas@Tobion

[8]ページ先頭

©2009-2025 Movatter.jp