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

Serge::DB::Cached::find_best_translation() is not optimized for the disabled reuse_uncertain mode #9

Closed
iafan opened this issue Nov 30, 2015 · 0 comments

Comments

@iafan
Copy link
Contributor

iafan commented Nov 30, 2015

When reuse_uncertain mode is disabled, Serge::DB::Cached::find_best_translation() just detects that there are some translations for the string in the database and passes the call to Serge::DB::find_best_translation(). This method is slow, however, and it is run on each localization cycle for items that need to be translated but have multiple variants of translations in the database.

To optimize for this scenario, we can cache the number of translation variants for each source string in Serge::DB::Cached::preload_strings_for_lang() and then account for that number in Serge::DB::Cached::find_best_translation(), quitting early if reuse_uncertain is off, and there are multiple variants of the translation.

@iafan iafan closed this as completed in 7e37e27 Nov 30, 2015
iafan pushed a commit that referenced this issue Nov 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant