Qt translator efficiency
I am curious to know how efficient, Qt's translator algorithm is written for the look up (source to translation).
I was thinking about adding a timer before and stopping the timer after, the translator. Or, take the time snap before and take the time snap after the translation and check the difference.
But this would give me just one string translation.
My idea is to check, how much time it takes to translate the complete UI.
Any heads up on how to measure the efficiency?
That would partly depend on whether you have implemented dynamic translation (i.e. while the app is running) or at launch time. You would have to chase all tr calls.
Out of curiosity, why do you want to do that ?
I have got this question in my mind because,
I am implementing, Translator as a library. So that, even Non-Qt applications can be benefited of Qt translator.
Library may have an API -
GetTranslation (string, language)
This function, gets the string and uses the language and then uses Qt translator and translates, and it returns the translated string.
Having this as a library, other processes can link this library and get the benefits.
For example, if there is a process which manages Email, it has to translated the complete email content.
Email process may call this function for 1000s of times to get the content translated.
I was curious to know, will there be any performance impact.
The problem I see with your use case is that you can't translate an email literally like that: you'll end up with some non-understandable text at the end
I completely understand because, the sentence has to be translated not the words.
But just assume that, there is some one who needs to translate a 1000s of strings.
They will be calling my API to get the translations. End up calling 1000 times.
Do you see any performance impact?
I'd say: benchmark it, so you'll know how much time it takes to do the match. Don't forget to load several dictionaries to match real-life setup