Skip to content

perf(machinery): improve built-in machinery queries#18627

Closed
nijel wants to merge 1 commit intoWeblateOrg:mainfrom
nijel:machinery-perf
Closed

perf(machinery): improve built-in machinery queries#18627
nijel wants to merge 1 commit intoWeblateOrg:mainfrom
nijel:machinery-perf

Conversation

@nijel
Copy link
Member

@nijel nijel commented Mar 24, 2026

This is AI-assisted approach:

  • do an exact lookup first and skip trigram lookup in case some matches are found (is there problem with skipping other matches in this case?)
  • create split indexes and split SQL query for translation memory, this seems to work better than forcing PostgreSQL to do the complex filtering on top of trigram

@nijel nijel requested a review from amCap1712 March 24, 2026 15:59
@nijel
Copy link
Member Author

nijel commented Mar 24, 2026

@amCap1712 I'd like to hear your feedback on this. It is not ready to be merged, as it will need a rebase on top of #18608 and a proper code review, as this is just AI-generated to discuss whether something like this looks reasonable.

@codecov
Copy link

codecov bot commented Mar 24, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@amCap1712
Copy link
Contributor

Doing exact matches first if they are common makes sense to me. I have used a similar approach in a different project. Will look into the code and split SQL query soon.

@amCap1712
Copy link
Contributor

Do you have a project/translation files that we can use to test the queries performance against? Like before and after?

BTW, the tests all look useless but that's expected and can be fixed after performance improvement is verified.

This is AI-assisted approach:

- do an exact lookup first and skip trigram lookup in case some matches
  are found (is there problem with skipping other matches in this case?)
- create split indexes and split SQL query for translation memory, this
  seems to work better than forcing PostgreSQL to do the complex
  filtering on top of trigram
@argos-ci
Copy link

argos-ci bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 18 changed Mar 25, 2026, 9:27 AM

@nijel
Copy link
Member Author

nijel commented Mar 25, 2026

I don't have actual test data to share. I have a local instance where I'm testing this, but really a more targeted test environment would be useful for such performance issues. The real-world servers often suffer from the slow translation memory lookups as can be seen in #18611.

The PR might be crappy right now, I didn't really go through the generated code. I just wanted to explore the idea of making the queries separately and better utilize indexes.

@nijel
Copy link
Member Author

nijel commented Mar 26, 2026

After several iterations and benchmark, I've extracted #18665 which shows clear wins. For the translation memory more work is needed.

@nijel
Copy link
Member Author

nijel commented Mar 26, 2026

Most of the ideas tested here proven not to be useful, so I'm closing this. @amCap1712 if you have another/refined ideas how to improve the translation memory performance, we can start that separately.

@nijel nijel closed this Mar 26, 2026
@nijel nijel deleted the machinery-perf branch March 26, 2026 14:44
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

Successfully merging this pull request may close these issues.

2 participants