Conversation
|
|
@timofei-iatsenko compiling is now so fast, I think I'll just go ahead and close that other PR because fetching from the cache is slower than compilation! Awesome work 🔥 |
|
I could not find the action for the extraction in passed checks, could you give a link or just share the numbers, before and after? |
|
I think you can also close this one #7138 as superseded |
|
It's all done in one step, so |
|
What were the previous metrics for I did some benchmarking yesterday and found that on my local machine, the difference between running the extract command with This suggests there is a bottleneck elsewhere in the extraction process. I’ll investigate further to identify what’s stalling the parallel execution. |
Yep I see the same result with |
|
The execution of extraction on a single core might slightly rise, because macro plugin now doing a bit more job then before. It now not only change the AST but also re-build scopes and bindings so lingui macro doesn't mess a react-compiler which is relying on the bindings information. Since the same macro babel plugin used for app build and for extraction it might affect extraction time. |
|
@mozzius i also suggest you to switch lingui config to ts or at least use import {defineConfig} from '@lingui/cli'
export default defineConfig({
locales: [
'en',
'an',
'ast',
'ca',
'cy',
'da',
'de',
'el',
'en-GB',
'eo',
'es',
'eu',
'fi',
'fr',
'fy',
'ga',
'gd',
'gl',
'hi',
'hu',
'ia',
'id',
'it',
'ja',
'km',
'ko',
'ne',
'nl',
'pl',
'pt-BR',
'pt-PT',
'ro',
'ru',
'sv',
'th',
'tr',
'uk',
'vi',
'zh-CN',
'zh-HK',
'zh-TW',
],
catalogs: [
{
path: '<rootDir>/src/locale/locales/{locale}/messages',
include: ['src'],
},
]
})I dropped a Also i recommend to add a |
|
@timofei-iatsenko thanks for the tip! I also added What exactly does |
|
I found a culprit of a slower extraction. It was a sorting, the sort function creates a const collator = new Intl.Collator("en-US");on every invocation. So without a patch, the numbers look like: With a patch it looks like 3.981s vs 138.494ms
It basically tells the Lingui CLI that you are using Also, when Lingui writes the catalog for the source locale, it automatically pre-populates translations for new entries: # en.po
#. Accessibility label for a category
#: src/components/InterestTabs.tsx:330
msgid "(contains embedded content)"
msgstr "(contains embedded content)" # <-- Automatically filled for source localeWhen you compile catalogs, the fallback system uses the If This helps you avoid updating every single catalog file every time you run an extract. You only need to touch the other catalogs when you actually have new translations to add. A further step would be using I know this is a bit complicated - let me know if it’s still not clear and I can try explaining it differently! |
|
|
@mozzius here is a patch for extraction performance @lingui+cli+5.9.1.patch You can use it temporarly, while I preparing a fix in the |
|
All sounds great to me! :) Sorry if this is a silly question, but as long as a full extract and compile is run before a release is cut, that's the main thing that matters to ensure that all the updated translations make it into a release, right? 🤔 |
|
@surfdude29 yes, all our CI does this and will continue to do so just to be safe |
| // not ideal - t only gets called once at module evaluation time | ||
| const text = t`Hello World`; | ||
|
|
||
| // however, this is suitable for strings that are ephemeral: |
d447e9f to
dc4171d
Compare
|
@mozzius Also worth noting that the compile step could be skipped via: https://lingui.dev/ref/metro-transformer Not sure if it has performance implications or perhaps compatibility issues for web, just wanted to bring attention to it. |
|
@mozzius since compiling time is no longer an issue - you can use bundler loaders (metro-transformer or webpack/vite) This will eliminate a manual step of compiling and made a local development a bit more pleasant. But it's better to test performance, because as i mentioned bundler loaders could not benefit from multithreading of compile cli command. |
|
Thanks @fobos531 and @timofei-iatsenko - I'll look into it! |
dc4171d to
f7b8574
Compare





https://lingui.dev/releases/migration-5
@lingui/macroShould make it faster (as it now has multithread compilation!) and lets us use the hook macro:
CI is now 3x faster! (was 60 seconds). In fact, seems like the vast majority of the time is spent extracting, and now compiling is insanely fast.
Test plan
I recommend looking at the commits independently and just checking I did the migration guide correctly. Then just see if it runs