Bug 518351 - Android: setting language and fallback language makes everything slow.
Summary: Android: setting language and fallback language makes everything slow.
Status: ASSIGNED
Alias: None
Product: krita
Classification: Applications
Component: Translation (other bugs)
Version First Reported In: 5.3.0
Platform: Android Android 14.x
: NOR normal
Target Milestone: ---
Assignee: dra.w.p.il.e+bugskde
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-03-30 21:15 UTC by dra.w.p.il.e+bugskde
Modified: 2026-04-06 09:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dra.w.p.il.e+bugskde 2026-03-30 21:15:14 UTC
SUMMARY
On Android, setting British English as the primary language and Czech as the fallback language makes Krita load extremely slow. Startup time goes from around 10 seconds to several minutes, many other loads take ages as well. Other language combinations may have similar behavior.

STEPS TO REPRODUCE
1. Open Settings > Switch Application Language. 
2. Set the primary language to British English.
3. Add a fallback language to čeština (Czech).
4. Exit Krita via File > Quit and start it again.

OBSERVED RESULT
Krita takes ages to load. Opening a document and many other operations are also extremely slow.

EXPECTED RESULT
For it to run normally.

SOFTWARE/OS VERSIONS
Android 13 on a Samsung S6 Lite, also happens on S11 Ultra.

ADDITIONAL INFORMATION
https://krita-artists.org/t/what-is-the-progress-of-the-mobile-rework-and-some-questions-about-the-roadmap/177624/3
Comment 1 Bug Janitor Service 2026-04-05 19:01:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/2743
Comment 2 dra.w.p.il.e+bugskde 2026-04-05 19:24:56 UTC
Slowness is caused by KFI18N's loadMessageCatalogFile called by loadMessageCatalog. It calls closeLoadedMessageCatalog a lot, as well as immense amounts of fread, malloc and free. So much that even just the malloc and free is taking several seconds during startup. Kind of looks like it's unloading and reloading the translation loads of times.

The merge request above just removes the ability to set fallback languages on Android, since all that currently does is to make Krita unusable.
Comment 3 Dmitry Kazakov 2026-04-06 09:16:40 UTC
Git commit 0c19b432db178a88a372c2e4de393a1dcfa9f46e by Dmitry Kazakov, on behalf of Carsten Hartenfels.
Committed on 06/04/2026 at 09:16.
Pushed by dkazakov into branch 'krita/6.0'.

[android] Don't allow setting fallback languages

To work around KI18N's incredible slowness when setting multiple
languages in KLocalizedString. Currently, setting a fallback language
makes Krita completely unusable anyway, so this should be no loss in
functionality, it just prevents the user from breaking the application.
If/when upstream fixes this bug or we upgrade to a later version that
doesn't have it, we can remove this hack again.

This duplicates some logic between the main file and the language
switcher dialog, but that's how the situation is already, all other
logic regarding the language settings is duplicated in both places and I
don't want to do refactorings as part of a hack like this.

Specifically, the slowness is in KF18N's loadMessageCatalogFile, called
by loadMessageCatalog. This calls closeLoadedMessageCatalog, fread,
malloc and free ludicrous amounts of times. Like, multiple seconds
during Krita's minutes-long startup time are just spent inside malloc
and free. It's like it's constantly reloading the entire translation.

M  +22   -4    krita/main.cc
M  +26   -7    libs/widgetutils/xmlgui/kswitchlanguagedialog_p.cpp

https://invent.kde.org/graphics/krita/-/commit/0c19b432db178a88a372c2e4de393a1dcfa9f46e
Comment 4 Dmitry Kazakov 2026-04-06 09:17:35 UTC
Git commit d47c1f6bd2b60189efd8237d014d170f2933f987 by Dmitry Kazakov, on behalf of Carsten Hartenfels.
Committed on 06/04/2026 at 09:17.
Pushed by dkazakov into branch 'release/6.0.0'.

[android] Don't allow setting fallback languages

To work around KI18N's incredible slowness when setting multiple
languages in KLocalizedString. Currently, setting a fallback language
makes Krita completely unusable anyway, so this should be no loss in
functionality, it just prevents the user from breaking the application.
If/when upstream fixes this bug or we upgrade to a later version that
doesn't have it, we can remove this hack again.

This duplicates some logic between the main file and the language
switcher dialog, but that's how the situation is already, all other
logic regarding the language settings is duplicated in both places and I
don't want to do refactorings as part of a hack like this.

Specifically, the slowness is in KF18N's loadMessageCatalogFile, called
by loadMessageCatalog. This calls closeLoadedMessageCatalog, fread,
malloc and free ludicrous amounts of times. Like, multiple seconds
during Krita's minutes-long startup time are just spent inside malloc
and free. It's like it's constantly reloading the entire translation.

M  +22   -4    krita/main.cc
M  +26   -7    libs/widgetutils/xmlgui/kswitchlanguagedialog_p.cpp

https://invent.kde.org/graphics/krita/-/commit/d47c1f6bd2b60189efd8237d014d170f2933f987
Comment 5 dra.w.p.il.e+bugskde 2026-04-06 09:20:40 UTC
We'll wait with  submitting a bug report about this upstream until we switch to KF6, since there won't be a fix to KF5 anyway. I'll assign this to me for that.