RFC: Cache translated strings in Job::emit functions
ClosedPublic

Authored by broulik on Dec 19 2018, 9:32 AM.

Details

Summary

These are called repeatedly for every single file processed and we end up spending non-trivial amounts of time doing translation work.

Test Plan

Copied 1000 files, spends 6.24% of time in i18ndc calls
Not sure about implications on thread-safety and we don't evcit those strings anymore, but they're not that many..

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Dec 19 2018, 9:32 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptDec 19 2018, 9:32 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
broulik requested review of this revision.Dec 19 2018, 9:32 AM
broulik edited the test plan for this revision. (Show Details)Dec 19 2018, 9:42 AM
aacid added a subscriber: aacid.Dec 19 2018, 8:50 PM

That 6% goes to 0% i guess?

dfaure accepted this revision.Dec 19 2018, 9:49 PM

Good idea.

This is indeed threadsafe, since in C++11 static objects are threadsafe.
And this is done on demand the first time the function is called, so qApp exists and the catalogs are loaded, etc. no problem.

This revision is now accepted and ready to land.Dec 19 2018, 9:49 PM

That 6% goes to 0% i guess?

Pretty much, goes down to 0.07%

This revision was automatically updated to reflect the committed changes.