Closed
Bug 1407016
Opened 7 years ago
Closed 6 years ago
Speed up saving translations
Categories
(Webtools Graveyard :: Pontoon, enhancement, P2)
Webtools Graveyard
Pontoon
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: mathjazz, Assigned: jotes)
References
Details
Attachments
(1 file)
When a new translation is submitted, or existing translation is (un)approved or rejected, we update stats using the TranslatedResource.calculate_stats() method.
It identifies translation status *for each string within the file* and then calculates diff for each status count on a file level. It uses the diff to update stats for corresponding TranslatedResource, Project, Locale and ProjectLocale instance (stats are denormalized for performance reasons).
While this works well during sync or file upload, it's far from optimal when only one string is updated (like on translation submit).
Instead, we should calculate the diff by checking translation status *for the edited string* before and after submission. Quick testing shows that saving a translation should be 60-80% faster with this optimization.
Marking as P2 as this is a substantial optimization of a critical task. New Relic says that saving a translation is the 3rd most common task (after opening a string for editing and accessing a team page).
Note: This is a continuation of bug 1344658.
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → poke
Reporter | ||
Updated•6 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•6 years ago
|
||
:mathjazz
The good news is: The problem is reproducible on my machine.
Average response time is around ~100ms for `unapprove`/`reject` views. I can verify that calculate_stats takes around 50-60% of the total time of the request.
I'll post the performance comparison in the PR.
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
Commit pushed to master at https://github.com/mozilla/pontoon
https://github.com/mozilla/pontoon/commit/a18fdd7dc2d204ab6376233b82d573df6119450b
Fix bug 1407016: Speed up saving translations (#1140)
This patch replaces the expensive file-level calculate_stats() method
with EntityLocale-level get_stats() and get_stats_diff() methods.
Updated•6 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Updated•3 years ago
|
Product: Webtools → Webtools Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•